• 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

ZipOutputStream and nested zip files

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to create a zip file that itself contains
zip files. I'm assuming that I have to create the
nested zip file on the file system. And then add it
to the main zip file via ZipOutStream's putNextEntry().
And basically read in the nested file and write it out to the
main zip file?
Is this true? wanted to make sure there wasn't some sort
of trick that would make this easier.
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Stephanie,
Basically a ZIP file is just another file. So, if you want to include ZIP files in another ZIP file, the way you proceed is correct. You first have to create the nested ZIPs and then add those to the main ZIP.

------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
 
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stephanie,
Let me first ask why are you creating nested zip? First, it only complicates thing and you're not going to get better compression. In fact, if you take a zip file and keep on nesting it, your zip file will eventually just grow, because the zip algorithm cannot compress the original content anymore, but it does have to add header information. So all your doing with each nesting is just zipping a little bit of header information.
-Peter
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with you Peter, but maybe what Stephanie wants is just to group different ZIP files together in one to facilitate download or I don't know...
Let us know Stephanie why you are zipping ZIPs

------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
 
Stephanie Smith
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds good, thanks for all the advice. We have nested zips mainly to provide a way to group information. Users can nest
files that are related in a nested zip. We allow the
calling application to decide whether or not to do this.
By default we do not create nested zips, but again, we do
allow for it.
thanks!
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's what I thought... Zipping for groupping is a good idea. That's exactly what the JAR files are for by the way...
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
 
reply
    Bookmark Topic Watch Topic
  • New Topic