Possible Duplicate:
Decode Base64 data in java
I am working on java profile, I want to know , how to convert the base64 string to byte array. could any one please provide code & it will be help fule to me.
You can also use Apache Commons Codec (http://commons.apache.org/codec/)
String example = "SGVsbG8gV29ybGQ="
byte[] decoded = org.apache.commons.codec.binary.Base64.decodeBase64(example .getBytes());
import sun.misc.BASE64Decoder;
BASE64Decoder decoder = new BASE64Decoder();
byte[] imageByte = decoder.decodeBuffer(imageData);
Where imageData
is String containing Base64 data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With