This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman 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 Building Microservices this week in the Design 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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: ZIP File reading
jQuery in Action, 3rd edition