java.util.jar
Class JarFile
java.lang.Object
|
+--java.util.zip.ZipFile
|
+--java.util.jar.JarFile
public class
JarFileextends
ZipFile Representation of a jar file.
Note that this class is not a subclass of java.io.File but a subclass of
java.util.zip.ZipFile and you can only read JarFiles with it (although
there are constructors that take a File object).
XXX - verification of Manifest signatures is not yet implemented.
Since:Author:- Mark Wielaard (mark@klomp.org)
MANIFEST_NAME
public static final String MANIFEST_NAME
The name of the manifest entry: META-INF/MANIFEST.MF
JarFile
public JarFile(java.io.File file)
Creates a new JarFile. All jar entries are verified (when a Manifest file
for this JarFile exists). You need to actually open and read the complete
jar entry (with getInputStream()
) to check its signature.
Parameters:
Throws:
JarFile
public JarFile(java.io.File file, boolean verify)
Creates a new JarFile. If verify is true then all jar entries are
verified (when a Manifest file for this JarFile exists). You need to
actually open and read the complete jar entry
(with getInputStream()
) to check its signature.
Parameters:
Throws:
JarFile
public JarFile(java.io.File file, boolean verify, int mode)
Creates a new JarFile with the indicated mode. If verify is true then
all jar entries are verified (when a Manifest file for this JarFile
exists). You need to actually open and read the complete jar entry
(with getInputStream()
) to check its signature.
manifest and if the manifest exists and verify is true verfies it.
Since:Parameters:
Throws:
JarFile
public JarFile(java.lang.String fileName)
Creates a new JarFile. All jar entries are verified (when a Manifest file
for this JarFile exists). You need to actually open and read the complete
jar entry (with getInputStream()
) to check its signature.
Parameters:
Throws:
JarFile
public JarFile(java.lang.String fileName, boolean verify)
Creates a new JarFile. If verify is true then all jar entries are
verified (when a Manifest file for this JarFile exists). You need to
actually open and read the complete jar entry
(with getInputStream()
) to check its signature.
Parameters:
Throws:
entries
public Enumeration entries()
Returns a enumeration of all the entries in the JarFile.
Note that also the Jar META-INF entries are returned.
Throws:
getEntry
public ZipEntry getEntry(java.lang.String name)
XXX
It actually returns a JarEntry not a zipEntry
Parameters:
getInputStream
public synchronized InputStream getInputStream(java.util.zip.ZipEntry entry)
XXX should verify the inputstream
Parameters:
Throws:
getJarEntry
public JarEntry getJarEntry(java.lang.String name)
Returns the JarEntry that belongs to the name if such an entry
exists in the JarFile. Returns null otherwise
Convenience method that just casts the result from getEntry
to a JarEntry.
Parameters:
Returns:
- the JarEntry if it exists, null otherwise
getManifest
public Manifest getManifest()
Returns the manifest for this JarFile or null when the JarFile does not
contain a manifest file.
Note that this class is not a subclass of java.io.File but a subclass of java.util.zip.ZipFile and you can only read JarFiles with it (although there are constructors that take a File object).
XXX - verification of Manifest signatures is not yet implemented.