Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ZipOutputStream and nested zip files

 
Stephanie Smith
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • 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.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • 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
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • 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
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • 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
  • 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
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic