Android : Android base64.decode() into existing byte array

on Tuesday, October 28, 2014


On Android, I'm using Base64.decode() method. It has several variants, but all of them decode the given base64 input into a newly created byte array.


Since I need to call this a lot with big inputs, it allocates a lot of memory and causes frequent GC.


So I'm wondering if there is a way to pass an existing byte array to the method, or alternative techniques, so that it puts the result inside the existing byte array and avoid allocating memory for a new one. That would be similar to the use of options.inBitmap in BitmapFactory when creating a bitmap in order to reuse an existing bitmap.


Thanks for your help


0 comments:

Post a Comment