How to create an zip file which contains gzip file in java? -


i able generate zip/gzip using gzipoutputstream/zipoutputstream

but no clue how use zipentry gzip file

thanks

there no zipentry gzip because gzip format not support multiple entries. hence, see files ".tar.gz" or ".tgz" combination of 2 formats: "tar" (for sticking multiple files together) , "gzip" (for compressing them).

update:

if want generate gzip file within zip file, need wrap gzipoutputstream around zipoutputstream (after calling .putnextentry). make sure don't call close() on gzipoutputstream, call .finish().


Comments