Java Base64 Decode decodeBase64(char[] data)

Here you can find the source of decodeBase64(char[] data)

Description

decode Base

License

Open Source License

Declaration

public static byte[] decodeBase64(char[] data) 

Method Source Code

//package com.java2s;
import java.io.ByteArrayOutputStream;

public class Main {
    private static byte[] decodes = new byte[256];

    public static byte[] decodeBase64(char[] data) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream(data.length);
        int pos = 0, val = 0;
        for (int i = 0; i < data.length; i++) {
            val = (val << 6) | decodes[data[i]];
            pos += 6;/*from w w w . ja va 2  s  . c om*/
            while (pos > 7) {
                baos.write(val >> (pos -= 8));
                val &= ((1 << pos) - 1);
            }
        }
        return baos.toByteArray();
    }
}

Related

  1. base64decodebyte(String txt)
  2. base64Decoder(char[] src, int start)
  3. base64decodeString(String inputString)
  4. decode(String base64)
  5. decode(String base64Code)
  6. decodeBASE64(InputStream in, OutputStream out)
  7. decodeBase64(InputStream is, OutputStream os)
  8. decodeBase64(String base64Data)
  9. decodeBase64(String data)