The java.util.jar package, shown in Figure 11-1, contains two stream classes and another half dozen assorted classes and interfaces that assist in reading from and writing to JAR archives. As you can see, almost everything in this package is a subclass of a related class in the java.util.zip package. JAR files are zip files, and they are read and written just like zip files. This package mostly adds support for reading and writing manifests. You don't have to use the java.util.jar package at alljava.util.zip and the standard I/O and string classes are enough to do anything you need to dobut java.util.jar certainly does make your job easier when you need to read manifest entries.
Figure 11-1. The java.util.jar package hierarchy
All of the classes in java.util.jar are used much like their superclasses are. For instance, to read a JAR file, follow these steps:
These are the same six steps you use to read a zip file, only with the java.util.zip classes replaced by their counterparts in java.util.jar.
Basic I/O
Introducing I/O
Output Streams
Input Streams
Data Sources
File Streams
Network Streams
Filter Streams
Filter Streams
Print Streams
Data Streams
Streams in Memory
Compressing Streams
JAR Archives
Cryptographic Streams
Object Serialization
New I/O
Buffers
Channels
Nonblocking I/O
The File System
Working with Files
File Dialogs and Choosers
Text
Character Sets and Unicode
Readers and Writers
Formatted I/O with java.text
Devices
The Java Communications API
USB
The J2ME Generic Connection Framework
Bluetooth
Character Sets