What are the practical differences, in terms of pe...
9 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Barry_Wythoff
Posted On:   Wednesday, October 4, 2000 09:26 AM

What are the practical differences, in terms of performance and functionality, between ZipInputStream/ZipOutputStream and GZIPInputStream/GZIPOutputStream ?

Re: What are the practical differences, in terms of...

Posted By:   Luigi_Viggiano  
Posted On:   Sunday, March 11, 2001 09:03 AM

The compression algorithm is the same (Lempel-Ziv Welch), the difference is that GZIP format is used to compress a single file, and ZIP is used to compress many file in a single archive. In unix world you can find files using GZIP algorithm containing more than 1 file: it's done grouping files with tar utility before then compressing the stream in a "tar.gz" file (tarball).

If you have to compress a single file, it's better to use GZIP I/O classes, because there isn't multi-file archive handling and shall be faster than ZIP I/O classes. Viceversa, if you have to create an archive of more than 1 file, it's better to use ZIP I/O classes.

Re: What are the practical differences, in terms of...

Posted By:   Dane_Foster  
Posted On:   Friday, March 9, 2001 08:42 AM

It's kinda hard to do an even handed performance comparison between a Zip(Input/Output) Stream and a GZip(Input/Output) Stream because they are functionally different. The Zip format is both a compression format and an archive format while GZip is a compression format only. They both use the same basic compression algorithm so they should perform just about the same as far as compression is concerned. If you want detailed information about them check out Java I/O from Oreilly.

Re: What are the practical differences, in terms of...

Posted By:   Peter_Kofler  
Posted On:   Monday, March 5, 2001 11:55 PM

ZIPxxxStream supports more entries, i.e. different files inside a zip/jar archive
which may be processed independantly.

GZIPxxxStream is just a wrapper around an Input/Output-Stream to compress everything that goes through this stream. Thus GZIPxxxStream is only sequential (in terms of files/data read/written).

Re: What are the practical differences, in terms of...

Posted By:   Kevin_Riff  
Posted On:   Thursday, March 1, 2001 03:40 PM

GZIPInputStream and GZIPOutputStream read and write a single file which has been compressed in zip format. ZipInputStream and ZipOutputStream on the other hand deal with zip archives which may contain multiple files. Within an archive, files may be compressed or uncompressed.



Both GZIPInputStream/GZIPOutputStream and ZipInputStream/ZipOutputStream extend InflaterInputStream/DeflaterOutputStream which are the classes that actually perform the compression and decompression of the stream. I don't have any hard performance numbers, but given that they rely on the same implementation, I'd expect them to be about the same.

Re: What are the practical differences, in terms of...

Posted By:   Renato_Michielin  
Posted On:   Thursday, February 22, 2001 01:47 PM

gzip is a compression format while zip is an archive format.

GZIPOutputStream(GZIPInputStream) is a filter stream that compresses(decompresses) data

For example, GZIPOutputStream writes deflated data onto, usually, a FileOutputStream:


FileOutputStream fos = new FileOutputStream("datafile.gz");

GZIPOutputStream gos = new GZIPOutputStream(fos);

...use write() method to pass data through the stream



ZipOutputStream(ZipInputStream) deflates or stores(read) more than one file in a single zip file.
Writing(or reading) a zip file is not as simple as writing a gzip file in that each file is written in the output stream in a separate zip entry.

Re: What are the practical differences, in terms of...

Posted By:   Rajiv_Kanaujia  
Posted On:   Wednesday, February 21, 2001 09:48 PM

Both are data compression technique.
GZIP is based on RFC 1952. See http://freesoft.org/CIE/RFC/Orig/rfc1952.txt.
GZIP is mostly used in UNIX world.

ZIP is another old compression technique. PKWARE introduced the .ZIP file format
in 1989. It led the way in industry standard .ZIP format compression.

Java File IO provides reading and writing (creating) files based on GZIP or ZIP
file compression technique.

Performance is very much dependent on the disk IO speed. Assuming your Disk IO
is constant, you can use code like Long.toString((new Date()).getTime()) to get
a date before the file creation and do the same thing after the file creation. A
difference between them is the time taken to create/read/write a GZIP or ZIP
file.

Re: What are the practical differences, in terms of...

Posted By:   Rajiv_Kanaujia  
Posted On:   Monday, January 15, 2001 09:50 AM

Both are data compression technique.
GZIP is based on RFC 1952. See http://freesoft.org/CIE/RFC/Orig/rfc1952.txt.
GZIP is mostly used in UNIX world.

ZIP is another old compression technique. PKWARE introduced the .ZIP file format in 1989. It led the way in industry standard .ZIP format compression.

Java File IO provides reading and writing (creating) files based on GZIP or ZIP file compression technique.

Re: What are the practical differences, in terms of...

Posted By:   Dane_Foster  
Posted On:   Wednesday, November 15, 2000 07:35 AM

The difference is Gzip stream handles the compression and decompression as a single file/stream. Let's say you had a routine that read all the files in a directory and Gziped them, GZIPInputStream can merge all the files into one compressed object. Zip on the other hand can allow you to have one compressed file that contained multiple separate files inside of it (think winzip).

As for performance, there is no real difference because they are both subclasses of the deflator and inflator classes (respectively). The inflator and deflator superclasses is where the real work of compression and decompression takes place. If you want to speed up compression and decompression you would have subclasses Inflator and Deflator and change the compression format that they implement (see RFC 1950, 1951, and 1952 for description of compression formats).

Re: What are the practical differences, in terms of...

Posted By:   Jef_Newsom  
Posted On:   Monday, November 6, 2000 11:17 AM

Functionally, zip supports both compression of files and archival of the files into a single file, whereas gzip is simply compression of individual files. I believe they both use the same underlying deflation algorithm, so performance-wise, they should be roughly equivalent. If you browse the source for both, you will note that both extend Deflater*Stream. The zip has an extra method call and if check per write on the OutputStream versions.
About | Sitemap | Contact