This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes ZIP File reading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "ZIP File reading" Watch "ZIP File reading" New topic

ZIP File reading

Billy Nicholson

Joined: Jun 16, 2011
Posts: 8
Let's say you have a Zip File and you want to read it. You just take the ZipFile and .getInputStream(ZipEntry). Well, let's say the entry you want to read is a zip file, itself. Well, you: ZipInputStream inputStream = new ZipInputStream((zipFileHere).getInputStream(ZipEntry)). And then you read from there. Now, let's say you have a triple nested zip file. That is to say, a zip file...inside a zip file... inside a zip fie. How would you read from that? ZipInputStream doesn't have a ".getInputStream(ZipEntry e)" method...
Billy Nicholson

Joined: Jun 16, 2011
Posts: 8
Found out the answer.
Wrap a ZipInputStream around a ZipInputStream

ZipInputStream firstLevel = new ZipInputStream(ZipFile.getInputStream(ZipEntry));
ZipInputStream secondLevel = new ZipInputStream(firstLevel);
I agree. Here's the link:
subject: ZIP File reading
It's not a secret anymore!