The
java.util.jar package contains classes for reading and
writing Java archive, or JAR, files. A JAR file is nothing more than
a ZIP file whose first entry is a specially named manifest file that
contains attributes and digital signatures for the ZIP file entries
that follow it. Many of the classes in this package are relatively
simple extensions of classes from the
java.util.zip package.
The easiest way to read a JAR file is with
the random-access JarFile class. This class allows
you to obtain the JarEntry that describes any
named file within the JAR archive. It also allows you to obtain an
enumeration of all entries in the archive and an
InputStream for reading the bytes of a specific
JarEntry. Each JarEntry
describes a single entry in the archive and allows access to the
Attributes and the digital signatures associated
with the entry. The JarFile also provides access
to the Manifest object for the JAR archive; this
object contains Attributes for all entries in the
JAR file. Attributes is a mapping of attribute
name/value pairs, of course, and the inner class
Attributes.Name defines constants for various
standard attribute names.
You can also read a JAR file with
JarInputStream. This class requires to you read
each entry of the file sequentially, however.
JarOutputStream allows you to write out a JAR file
sequentially. Finally, you can also read an entry within a JAR file
and manifest attributes for that entry with a
java.net.JarURLConnection object.
Interfaces
public interface Pack200.Packer;
public interface Pack200.Unpacker;
Collections
public class Attributes implements java.util.Map<Object, Object>, Cloneable;
Other Classes
public static class Attributes.Name;
public class JarEntry extends java.util.zip.ZipEntry;
public class JarFile extends java.util.zip.ZipFile;
public class JarInputStream extends java.util.zip.ZipInputStream;
public class JarOutputStream extends java.util.zip.ZipOutputStream;
public class Manifest implements Cloneable;
public abstract class Pack200;
Exceptions
public class JarException extends java.util.zip.ZipException;
|