• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ZIP File reading

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 8
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found out the answer.
Wrap a ZipInputStream around a ZipInputStream

ZipInputStream firstLevel = new ZipInputStream(ZipFile.getInputStream(ZipEntry));
firstLevel.getNextEntry();
ZipInputStream secondLevel = new ZipInputStream(firstLevel);
etc.
 
This cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic