I’m wanting to execute a program and as it runs read in it’s output and pipe out the output into a zipped file. The output of the program can be quite large so the idea is to not hold too much in memory – just to send it to the zip as I get it.
Share
In otherwords:
ZipOutputStream, giving it the file you want to write to.You create a
ZipEntry, which constitutes a file within that zip file. i.e. When you open myFile.zip, and there are 3 files in there, each file is aZipEntry.You put that
ZipEntryinto yourZipOutputStreaminputStreaminto your byte buffer, and remember the count.countis not-1, write that byte byffer to yourzipStream.Close out your streams when you are done. Wrap it in a method as you see fit.