Java Base64 Convert to base64ToByte(String data)

Here you can find the source of base64ToByte(String data)

Description

From a base 64 representation, returns the corresponding byte[]

License

Apache License

Parameter

Parameter Description
data String The base64 representation

Exception

Parameter Description
IOException an exception

Return

byte[]

Declaration

public static byte[] base64ToByte(String data) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import sun.misc.BASE64Decoder;

import java.io.IOException;

public class Main {
    /**/*from w  w w  .ja  v  a 2  s .c  o m*/
     * From a base 64 representation, returns the corresponding byte[]
     * @param data String The base64 representation
     * @return byte[]
     * @throws IOException
     */
    public static byte[] base64ToByte(String data) throws IOException {
        BASE64Decoder decoder = new BASE64Decoder();
        return decoder.decodeBuffer(data);
    }
}

Related

  1. base642byte(String base64)
  2. base64StrToStream(String base64Str)
  3. base64ToByteArray(String data)
  4. base64ToFile(String base64Code, String targetPath)
  5. fromBase64(byte[] buf, int start, int length)
  6. fromBase64(final String encoded)