Reputation: 1
I have a zip file inside a zip file. So i will need to recursively unzip.The input is coming in as a byte array
zis = new ZipInputStream(new ByteArrayInputStream((byte[])byteArray));
while((entry = zis.getNextEntry()) != null)
{
processZip(entry, byteArray);
}
Inside the processZip(entry, byteArray) i am reading individual entry. How do i handle it when the entry value is a zip file. How can i convert the zipentry object into a Zipfile or enumerate through it ?
Upvotes: 0
Views: 805
Reputation: 310876
You need to adjust processZip()
to take the ZipInputStream
as an InputStream
parameter, instead of the byte array. Internally it should construct another ZipInputStream
around that InputStream
and do what you're doing here.
NB Why do you have a byte array? You should be reading the ZipInputStream
directly from the source: a socket, a file, whatever. Don't load files into memory.
Upvotes: 1