Java Byte Array Decode decode(byte[] b)

Here you can find the source of decode(byte[] b)

Description

decode

License

Open Source License

Declaration

public static byte[] decode(byte[] b) throws Exception 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.ByteArrayInputStream;

import java.io.InputStream;

import javax.mail.internet.MimeUtility;

public class Main {
    public static byte[] decode(byte[] b) throws Exception {
        ByteArrayInputStream bais = new ByteArrayInputStream(b);
        InputStream b64is = MimeUtility.decode(bais, "base64");
        byte[] tmp = new byte[b.length];
        int n = b64is.read(tmp);
        byte[] res = new byte[n];
        System.arraycopy(tmp, 0, res, 0, n);
        return res;
    }/*from   www . ja va  2  s.co m*/
}

Related

  1. decode(byte[] bytes)
  2. decode(byte[] bytes)
  3. decode(byte[] bytes)
  4. decode(byte[] msgToDecode)