Author Topic: Create zip using inputstream and outputstream  (Read 4512 times)

biki

  • Newbie
  • *
  • Posts: 7
    • View Profile
Create zip using inputstream and outputstream
« on: July 23, 2013, 02:19:36 PM »
Hi
I am working on a distributed file system where I can get access to only InputStreams and OutputStreams. I am able to create a ZipOutpurStream, but I cannot get access to a File Object. HDFS to be exact. Also when the files are huge, using input and output streams makes memory management easier.
Any ideas?


Thanks for the consideration.

Thanks and Regards
Bikram Kashyap

biki

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Create zip using inputstream and outputstream
« Reply #1 on: July 23, 2013, 02:22:38 PM »
Basically when using the zipOutputStream, this fails
outputStream.putNextEntry(file,parameters);

Not sure how to get around this issue.

Thrawn

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Create zip using inputstream and outputstream
« Reply #2 on: November 12, 2013, 11:56:12 PM »
I believe the File object in this case is just for providing metadata to zip4j. If you look in the CreateZipWithOutputStreams example, you can see that after starting the entry, you then write all the bytes to the ZipOutputStream yourself. So, you should be able to create a dummy File object, pass that in, and then proceed as usual.

However, IMHO, this feature request is valid. it would be better for ZipOutputStream to have an addStream method, taking an InputStream and ZipParams, just like ZipFile does.
« Last Edit: November 13, 2013, 12:48:59 AM by Thrawn »

Silvanavas

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Create zip using inputstream and outputstream
« Reply #3 on: September 08, 2015, 11:43:29 AM »
It is a web site that looks a lot like watching people do not do that very well.

 


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.