Author Topic: Creating a split archive from InputStreams  (Read 3773 times)

Sivrit

  • Newbie
  • *
  • Posts: 1
    • View Profile
Creating a split archive from InputStreams
« on: June 18, 2012, 11:59:41 PM »
Hi,

For the project I'm working on I need to create some (potentially split) zip archives containing big files. It seems very few implementations allow the split part... Actually, Zip4j is the only one I could find. Kudo on that.

Unfortunately, since my data will come from a database and will be stored as multiple entries, I need to provide Zip4j with multiple InputStreams at once, which the API does not allow.

Adding this possibility does not seem too hard though. I prototyped a solution (joined in a patch): All entries would be provided through an Iterator. Since both a ZipParameters and an InputStream are needed at each step, I created the class ZipStreamEntry to act as container.

The tricky part is actually on the client side which is tasked with providing the Iterator. net.lingala.zip4j.util.ZipStreamEntryIterator is a first try to provide some help on that point, but it is very sketchy. Some work would be needed to ensure no thread gets stuck if something fails. Besides, I think an implementation that mimics java.util.zip.ZipOutputStream and plugs its input into that Iterator would be nice, to act as a replacement for the original version.

Anyway, I join "Test.java" as a usage example.


If you are interested, I'm willing to contribute some work on the subject.

Regards,
Tristan BARTEMENT.

admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 403
    • View Profile
Re: Creating a split archive from InputStreams
« Reply #1 on: September 05, 2012, 09:39:27 PM »
Hi,

Thank you very much for your contribution. I will have a look at your patch, and will include in one of the upcoming releases.

Regards,
Srikanth

Wamimodo

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Creating a split archive from InputStreams
« Reply #2 on: August 18, 2015, 01:32:10 PM »
I really like this one too.

 


Warning: Cannot modify header information - headers already sent in /home/content/66/5374066/html/zip4j/forum/Sources/Errors.php on line 346

Warning: Cannot modify header information - headers already sent in /home/content/66/5374066/html/zip4j/forum/Sources/Errors.php on line 347

Warning: Cannot modify header information - headers already sent in /home/content/66/5374066/html/zip4j/forum/Sources/Errors.php on line 348

Warning: Cannot modify header information - headers already sent in /home/content/66/5374066/html/zip4j/forum/Sources/Errors.php on line 351

Warning: Cannot modify header information - headers already sent in /home/content/66/5374066/html/zip4j/forum/Sources/Errors.php on line 352

Warning: Cannot modify header information - headers already sent in /home/content/66/5374066/html/zip4j/forum/Sources/Errors.php on line 353
Connection Problems

Connection Problems

Sorry, SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later.