• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Creating spanned ZIP with Java?

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 27534
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22716
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 27534
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 22716
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As for WinZip and command line, WinZip has its own Command Line Support Add-on.
 
reply
    Bookmark Topic Watch Topic
  • New Topic