I have a problem reading the content of a zip file retrieved from a webservice.
The zip file is stored in a byte array called bytes
as you can see in the code below.
ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(bytes.get()));
String rawJson = IOUtils.toString(zis);
When I execute IOUtils.toString(zis)
I get an OutOfMemoryError: Java heap space.
I'm shure that the problem is caused by the dimension of the json file contained in the zip, is bigger than 150MB. I've tried with other smaller files and I can get the json content without any problem.
Is there a way to read the content of the zip without storing it in memory?
EDIT: I know that I could increase my heap memory but I'm looking for a code-based solution because it woud work on any environment.