Reputation: 1196
I have image in blob format from DB , i am holding that blob image in byte array and converting it to Binary Base64 format.
For encoding the blob to binary base 64 I am using below code,
byte[] imageByte = getblob();//from DB
byte[] encodedImage = Base64.encodeBase64(imageByte);
is there any other way to do it or am doing it in right way please help me?
Upvotes: 1
Views: 17510
Reputation: 17131
Try this code:
String imgString = Base64.encodeToString(bytes,
Base64.NO_WRAP);
Upvotes: 0
Reputation: 3099
if its not working than you can use
fileData.encode('base64')
this will solve the purpose
Upvotes: 0