Shawn
Shawn

Reputation: 779

Base64.encode() not working for large byte array

This line of code seems stop working when size of input byte array is too large:

byte[] encoded = Base64.encode(content, Base64.DEFAULT);

where the input is: byte[] content which is very large.

Is there anyway to get around this large size problem.

Thanks in advance!

Shawn

Upvotes: 0

Views: 1702

Answers (2)

Arvind Kumar Avinash
Arvind Kumar Avinash

Reputation: 78945

Instead of Base64, you can use Base64InputStream which provides Base64 encoding and decoding in a streaming fashion (unlimited size). You can check this for some examples.

Upvotes: 1

eattrig
eattrig

Reputation: 326

With the limited information provided, the only thing I can think to suggest is to break up the content array into smaller chunks and iterate through them.

Upvotes: 0

Related Questions