Home arrow Java & J2EE arrow Page 2 - GZIPping with Java

GZIP vs. ZIP - Java

The gzip format is the de facto standard compression format in the UNIX and Linux worlds.  In a previous Dev Shed article titled Zip Meets Java, Kulvir demonstrated how to use the java.util.zip package to programmatically manipulate files in the ZIP format.  In this article, we’ll cover how to use the java.util.zip package to create and read files using the gzip format.

  1. GZIPping with Java
  2. GZIP vs. ZIP
  3. Enough… Let’s Write Some GZIP Code
  4. And the Other Way Around: Uncompressing Your GZIP Files (Programmatically)
  5. Leveraging GZIP in the Web World
By: Kulvir Singh Bhogal and Javid Jamae
Rating: starstarstarstarstar / 30
February 18, 2004

print this article



Unlike ZIP utilities, the gzip utility does not archive multiple files into one file.  On the contrary, gzip compresses one file into one gzip file.  In order to compress multiple files, one must first use another utility called TAR. TAR uses an archival algorithm to join multiple files into one file. 
Compressing a file that is already compressed doesn’t do much.  For example, GIF is a compressed image format, so when you ZIP or gzip a GIF file, the resulting file will usually be pretty similar in size to the original GIF file. However, if you TAR a number of GIF files into a single file and then gzip the TAR file, a significant size saving can be achieved. This is because there may be common strings found across the joined files that gzip can compress, thus further reducing the total size of the already compressed GIF files.
It is also important to note that GZIP does not support encryption whereas ZIP does. The makers of GZIP find the encryption provided by ZIP to be “weak.” They also suggest using PGP if the user desires strong encryption as well as compression. In fact, PGP incorporates the gzip compression code. See our references section for a link to the PGP Website.

>>> More Java & J2EE Articles          >>> More By Kulvir Singh Bhogal

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- More Java Bugs Lead to More Attacks
- Oracle's Java One Brings News, Surprises
- Oracle Patches Java Runtime Environment
- Apple Syncs Java Update with Oracle
- Spring 3.1 Java Development Framework Compat...
- Jelastic Java PaaS Availability and Pricing ...
- NetBeans 7.1 Released, Supports JavaFX 2
- SolarWinds Releases Newest Version of Java M...
- Free Monitoring Tool for Java Apps on Heroku
- Heroku Adds JCloud Platform Support, Java 7 ...
- Java SE 8 Speculation in Full Swing
- Java SE 7 Now Available
- New JVM Language and Java Reporting Tool
- Java 7 Release Update and New Eclipse Toolkit
- The Best Java Netbeans IDE Plugins

Developer Shed Affiliates


Dev Shed Tutorial Topics: