Home arrow Java & J2EE arrow GZIPping with Java

GZIPping with 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



Some Background About GZIP

gzip (short for GNU zip) is a compression utility (mainly found on the *NIX platforms) that produces files with an extension of .gz.  gzip was created by by Jean-Loup Gailly and Mark Adler as a replacement for the compress utility and offers better compression ratios and an open (non-patented) compression algorithm. The sister utility, gunzip, is used to decompress files that are in the gzip format.  The intricacies of the gzip format are beyond the scope of this article. However, you can learn more about the compression and decompression algorithms used by gzip by following the link in our references section at the end of this article.  You can learn more about the format of the gzip files by reading RFCs 1951 and 1952.
Some of the key points include:

  1. A lossless compressed data format

  2. Data is compressed using the LZ77 algorithm and Huffman coding

  3. Format is not covered by patents, thus making it publicly usable without fear of legal repercussion

  4. Format includes a cyclic redundancy check value to detect data corruption and ensure data integrity

Since its inception, the gzip format has gained a popular following.  For example, the gzip utility has been formally adopted by the GNU project. There are free downloadable utilities for various platforms that can compress and decompress files in the gzip format.  In Java, the gzip functionality lives in the java.util.zip package, which has been around since Java 1.1. 

>>> 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: