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

Creating spanned ZIP with Java?

 
Ruben Matthews
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would I create a spanned archive with Java, so that a large directory or file can be stored in chunks of a couple of Mbs? Is that possible with Java's ZIP API? I don't see any methods that offer this possibility.
 
Paul Clapham
Sheriff
Posts: 21576
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't believe that there are any such methods. But on the other hand, people haven't been using spanned ZIP archives since floppy disks went out of fashion about five years ago. :-P
 
Rob Spoor
Sheriff
Pie
Posts: 20751
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe not spanning ZIPs, but spanning archives (especially RAR) is still widely used. Not for floppies, but mostly for Usenet these days.
 
Ruben Matthews
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think Java's ZIP API can do it unfortunately. I've been looking for other API's as well but without any luck. If there is anyone that knows an API that can do it I am very happy to hear it.
ZIP isn't absolutely necessary. Any other type of compression will do as long as I can create spanned archives from code.
 
Joe Ess
Bartender
Posts: 9339
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can always invoke the zip program from the command line with Runtime.exec().
 
Ruben Matthews
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Joe I see it's possible to split ZIP files with the Winzip interface, but I am not sure there is a command line argument for splitting files. I'm still looking into that. Using Winzip however, would make my program rely on Winzip, right? I prefer avoiding that.

Your suggestion did direct me to a different possible solution. Perhaps I could use Java to ZIP the entire contents of the folder and then use Java to split the ZIP file myself? Or is that for rocket scientists? I am not really familiar with the internals of files. Would it be possible to use Java to do something like this:

1. Read contents of directory and create ZIP (possible)
2. Open the file again in Java, but not with the ZIP API.
3. Read the file, and while reading, split the file into smaller bits of X Mb and save them (along with some code that defines the order)
 
Paul Clapham
Sheriff
Posts: 21576
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could certainly make a ZIP archive and then chop it into pieces with Java, no problem. That wouldn't be a spanned ZIP archive, because the pieces wouldn't be in the right format, but perhaps that isn't really a problem.
 
Rob Spoor
Sheriff
Pie
Posts: 20751
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As for WinZip and command line, WinZip has its own Command Line Support Add-on.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic