Java Reference
In-Depth Information
•
JarFile
represents an actual
JAR
file and allows that
JAR
file to be
read or written.
•
JarInputStream
reads a
JAR
file. Methods exist that read each entry
of the
JAR
file into a new
JarEntry
object.
•
JarOutputStream
writes a
JAR
file. Methods exist that take a
JarEntry
object that is written to the
JAR
file.
•
Manifest
maintains manifest entry names and their associated at-
tributes.
A
JarFile
represents an actual
JAR
file and allows its contents to be read
or written with the appropriate streams. A
JAR
file consists of a manifest
and a number of
JAR
entries that can be read or written individually. The
manifest contains all the attributes of the
JAR
file and all the attributes
of the entries in the
JAR
file. The manifest is decoded with the
Manifest
and
Attributes
classes. Each
JarEntry
contains the per-entry attributes
extracted from the manifest.
Most users never need to use the classes within
java.util.jar
.
JAR
files
can be created via tools supplied as part of your development environ-
ment and are read automatically by the class loader within the virtual
machine when needed.
25.9.3.
ZIP
Files
java.util.zip
The
java.util.zip
package provides classes for reading and writing
standard
ZIP
and
GZIP
file formats. We mention it only for completeness,
as it predates the newer
JAR
file format and forms its basis.
•
ZipFile
represents a
ZIP
or
GZIP
format file.
•
ZipEntry
represents an entry in a
ZIP
or
GZIP
format file.
•
ZipInputStream
reads
ZIP
file format.