home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Java in a Nutshell

Previous Chapter 31 Next
 

31. The java.util.zip Package

The java.util.zip package contains classes for data compression and decompression. It is new in Java 1.1. Figure 31.1 shows the class hierarchy of the package.

The Deflater and Inflater classes perform data compression and decompression. DeflaterOutputStream and InflaterInputStream apply that functionality to byte streams; the subclasses of these streams implement both the GZIP and ZIP compression formats. The Adler32 and CRC32 classes implement the Checksum interface and compute the checksums required for data compression.

31.1 java.util.zip.Adler32 (JDK 1.1)

This class implements the Checksum interface and computes a checksum on a stream of data using the Adler-32 algorithm. This algorithm is significantly faster than the CRC-32 algorithm and is almost as reliable.

The CheckedInputStream and CheckedOutputStream classes provide a higher-level interface to computing checksums on streams of data.

public class Adler32 extends Object implements Checksum {
    // Default Constructor: public Adler32()
    // Public Instance Methods
            public long getValue();  // From Checksum
            public void reset();  // From Checksum
            public void update(int b);  // From Checksum
            public native void update(byte[] b, int off, int len);  // From Checksum
            public void update(byte[] b);
}


Previous Home Next
java.util.Vector (JDK 1.0) Book Index java.util.zip.CheckedInputStream (JDK 1.1)

Java in a Nutshell Java Language Reference Java AWT Java Fundamental Classes Exploring Java