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

Java Fundamental Classes Reference

Previous Chapter 1

1.8 The java.util.zip Package

The java.util.zip package is new in Java 1.1. It contains classes that provide support for general-purpose data compression and decompression using the ZLIB compression algorithms. The important classes in java.util.zip are those that provide the means to read and write data that is compatible with the popular GZIP and ZIP formats: GZIPInputStream, GZIPOutputStream, ZipInputStream, and ZipOutputStream.

The GZIP and ZIP classes are easy to use because they subclass java.io. FilterInputStream and java.io.FilterOutputStream. While a GZIP file is simply a stream of compressed data, a ZIP file, or archive, can contain multiple compressed files. A ZipEntry object represents each compressed file in the archive. The ZipFile class is provided as a convenience for reading an archive; it allows nonsequential access to the entries in a ZIP file while the ZipInputStream class provides only sequential access.

The remainder of the classes in java.util.zip support the GZIP and ZIP classes. The generic Deflater and Inflater classes implement the ZLIB algorithms; they are used by DeflaterOutputStream and InflaterInputStream to decompress and compress data. The Checksum interface and the classes that implement it, Adler32 and CRC32, define algorithms that generate checksums from stream data. These checksums are used by the CheckedInputStream and CheckedOutputStream classes.

See Chapter 18, The java.util.zip Package, for complete reference material on all of the classes in the java.util.zip package.

Previous Home Next
The java.math Package Book Index Strings and Related Classes

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