2

I have developed an android application which will consume a large data in a zipped format. i used to unzip it and when i parse the unzipped file it shows outofmemory error since the Heap size increased to 125MB. I am using apache commons.io to fetch byte[] b and i am giving String s =new String(b);I tried Stringbuilder but i cant get that logic in place. Is there any other way to safely convert byte[] to String in android?

1
  • 2
    Don't forgot you are dealing with the mobile..... Commented Feb 12, 2013 at 18:39

1 Answer 1

6

There isn't a way to convert that much data at once (125MB) to a string. You're better off doing this in incremental steps in more mangeable chunks.

Sign up to request clarification or add additional context in comments.

3 Comments

Ya how to divide the byte[] into chunks and collect it in a string?\
Well, usually a character is a byte, so just parse each byte for the resulting string. More information here: stackoverflow.com/a/4850316/354247
If this answered your question, think about accepting it for the benefit of future users.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.