java.lang.Object | ||
↳ | java.util.zip.ZipFile | |
↳ | java.util.jar.JarFile |
Known Direct Subclasses |
The JarFile
class is used to read the contents of a jar file
from any file that can be opened with java.io.RandomAccessFile
.
It extends the class java.util.zip.ZipFile
with support
for reading an optional Manifest
entry. The
Manifest
can be used to specify meta-information about the
jar file and its entries.
Unless otherwise noted, passing a null argument to a constructor
or method in this class will cause a NullPointerException
to be
thrown.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | MANIFEST_NAME | The JAR manifest file name. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.util.zip.ZipFile
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new
JarFile to read from the specified
file name . | |||||||||||
Creates a new
JarFile to read from the specified
file name . | |||||||||||
Creates a new
JarFile to read from the specified
File object. | |||||||||||
Creates a new
JarFile to read from the specified
File object. | |||||||||||
Creates a new
JarFile to read from the specified
File object in the specified mode. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns an enumeration of the zip file entries.
| |||||||||||
Returns the
ZipEntry for the given entry name or
null if not found. | |||||||||||
Returns an input stream for reading the contents of the specified
zip file entry.
| |||||||||||
Returns the
JarEntry for the given entry name or
null if not found. | |||||||||||
Returns the jar file manifest, or
null if none. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.util.zip.ZipFile
| |||||||||||
From class
java.lang.Object
|
The JAR manifest file name.
Creates a new JarFile
to read from the specified
file name
. The JarFile
will be verified if
it is signed.
name | the name of the jar file to be opened for reading |
---|
IOException | if an I/O error has occurred |
---|---|
SecurityException | if access to the file is denied by the SecurityManager |
Creates a new JarFile
to read from the specified
file name
.
name | the name of the jar file to be opened for reading |
---|---|
verify | whether or not to verify the jar file if it is signed. |
IOException | if an I/O error has occurred |
---|---|
SecurityException | if access to the file is denied by the SecurityManager |
Creates a new JarFile
to read from the specified
File
object. The JarFile
will be verified if
it is signed.
file | the jar file to be opened for reading |
---|
IOException | if an I/O error has occurred |
---|---|
SecurityException | if access to the file is denied by the SecurityManager |
Creates a new JarFile
to read from the specified
File
object.
file | the jar file to be opened for reading |
---|---|
verify | whether or not to verify the jar file if it is signed. |
IOException | if an I/O error has occurred |
---|---|
SecurityException | if access to the file is denied by the SecurityManager. |
Creates a new JarFile
to read from the specified
File
object in the specified mode. The mode argument
must be either OPEN_READ or OPEN_READ | OPEN_DELETE.
file | the jar file to be opened for reading |
---|---|
verify | whether or not to verify the jar file if it is signed. |
mode | the mode in which the file is to be opened |
IOException | if an I/O error has occurred |
---|---|
IllegalArgumentException | if the mode argument is invalid |
SecurityException | if access to the file is denied by the SecurityManager |
Returns an enumeration of the zip file entries.
Returns the ZipEntry
for the given entry name or
null
if not found.
name | the jar file entry name |
---|
ZipEntry
for the given entry name or
null
if not foundIllegalStateException | may be thrown if the jar file has been closed |
---|
Returns an input stream for reading the contents of the specified zip file entry.
ze | the zip file entry |
---|
ZipException | if a zip file format error has occurred |
---|---|
IOException | if an I/O error has occurred |
SecurityException | if any of the jar file entries are incorrectly signed. |
IllegalStateException | may be thrown if the jar file has been closed |
Returns the JarEntry
for the given entry name or
null
if not found.
name | the jar file entry name |
---|
JarEntry
for the given entry name or
null
if not found.IllegalStateException | may be thrown if the jar file has been closed |
---|
Returns the jar file manifest, or null
if none.
null
if noneIllegalStateException | may be thrown if the jar file has been closed |
---|---|
IOException |