Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 139
Registered: ‎10-24-2010
My Device: BlackBerry 10 Dev Alpha
My Carrier: du

Re: base64Binary decoding



plz go on this thead and give me answer




how we can make chunks. 


This question is not related to this post so that's why refring other thread.

please mark posts as solved if you found a solution.
press the like button on the right side to thank the user that helped you.
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: base64Binary decoding



Apologies, I don't like the code because it does seem to introduce the possibility of a byte to String conversion, but the way you have coded it, this does not happen.


However I suspect the following is more efficient and uses less memory, since it converts from byte to byte (avoiding the byte to char, then to String, then to byte).


byte[] b = YourBase64EncodedString.getBytes();

byte[] _raw = decodeBase64(b, 0, b.length);

Bitmap _image = Bitmap.createBitmapFromBytes( _raw, 0, -1, 1 );


// Decodes the given byte array from Base64.

// Offset and length specify which part of the array to decode.

// The decoded data is returned as a byte array.

public static byte [] decodeBase64( byte[] toDecode, int offset, int length )


    // Create the input byte array to pass in the content.

    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream( toDecode, offset, length );

    // Create the base64 input stream.

    Base64InputStream base64InputStream = new Base64InputStream(byteArrayInputStream);

    byte [] returnBytes = IOUtilities.streamToBytes(base64InputStream);
    return returnBytes;

Posts: 133
Registered: ‎04-30-2010
My Device: Curve 8520
My Carrier: T-Mobile

Re: base64Binary decoding

@Peter_Strange Cheers Peter, that IS much more efficient
Posts: 12
Registered: ‎01-21-2013
My Device: BB10
My Carrier: BB10

Re: base64Binary decoding

can i find a boot code from converting image in bb10 !!!

Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: base64Binary decoding

I think you are in the wrong forum. 


Have a look at the possibilitities here:



and choose a BB10 related forum for the question.