Skip to content

Instantly share code, notes, and snippets.

@prodeezy
Created September 17, 2014 22:45
Show Gist options
  • Save prodeezy/1e70876a56fd73cfaea5 to your computer and use it in GitHub Desktop.
Save prodeezy/1e70876a56fd73cfaea5 to your computer and use it in GitHub Desktop.
protected Object bitmapToBase64(BitmapAgg myagg) throws HiveException {
ByteArrayOutputStream bos;
ObjectOutputStream oo;
try {
bos = new ByteArrayOutputStream();
oo = new ObjectOutputStream(bos);
myagg.bitmap.writeExternal(oo);
oo.close();
}catch(IOException ioe) {
throw new HiveException(ioe);
}
byte[] bas64EncodedBitmap = Base64.encodeBase64(bos.toByteArray());
return new String(bas64EncodedBitmap);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment