How about writing the zip file to the disk temporarily and then throw that to the user.
Or you can avoid this by increasing your heap space.
I would prefer the former one.
Joined: Jan 13, 2004
Thank you for your reply.
Actually I was improperly using a memory stream -- ByteArrayOutputStream as the actual stream for the ZipOutputStream, thus all the files will write to memory, for sure causing out-of-memory exception is just a matter of time.