Encode Decode Byte Array To Base64 String Using Java
Posted by tech on
November 11, 2009
The code uses non standard classes found in the sun.misc package to convert to and from Base64. These classes may change in the future. Taken from Example Depot.
// Convert a byte array to base64 string byte[] buf = new byte[]{0x12, 0x23}; String s = new sun.misc.BASE64Encoder().encode(buf); // Convert base64 string to a byte array buf = new sun.misc.BASE64Decoder().decodeBuffer(s);

/rating_on.png)







