java.util.jar

Class JarInputStream

public class JarInputStream extends ZipInputStream

InputStream for reading jar files. XXX - verification of the signatures in the Manifest file is not yet implemented.

Since: 1.2

Constructor Summary
JarInputStream(InputStream in)
Creates a new JarInputStream and tries to read the manifest.
JarInputStream(InputStream in, boolean verify)
Creates a new JarInputStream and tries to read the manifest.
Method Summary
protected ZipEntrycreateZipEntry(String name)
Creates a JarEntry for a particular name and consults the manifest for the Attributes of the entry.
ManifestgetManifest()
Returns the Manifest for the jar file or null if there was no Manifest.
ZipEntrygetNextEntry()
Returns the next entry or null when there are no more entries.
JarEntrygetNextJarEntry()
Returns the next jar entry or null when there are no more entries.
intread(byte[] buf, int off, int len)
XXX

Constructor Detail

JarInputStream

public JarInputStream(InputStream in)
Creates a new JarInputStream and tries to read the manifest. If such a manifest is present the JarInputStream tries to verify all the entry signatures while reading.

Parameters: in InputStream to read the jar from

Throws: IOException when an error occurs when opening or reading

JarInputStream

public JarInputStream(InputStream in, boolean verify)
Creates a new JarInputStream and tries to read the manifest. If such a manifest is present and verify is true, the JarInputStream tries to verify all the entry signatures while reading.

Parameters: in InputStream to read the jar from verify whether or not to verify the manifest entries

Throws: IOException when an error occurs when opening or reading

Method Detail

createZipEntry

protected ZipEntry createZipEntry(String name)
Creates a JarEntry for a particular name and consults the manifest for the Attributes of the entry. Used by ZipEntry.getNextEntry()

Parameters: name the name of the new entry

getManifest

public Manifest getManifest()
Returns the Manifest for the jar file or null if there was no Manifest.

getNextEntry

public ZipEntry getNextEntry()
Returns the next entry or null when there are no more entries. Does actually return a JarEntry, if you don't want to cast it yourself use getNextJarEntry(). Does not return any entries found at the beginning of the ZipFile that are special (those that start with "META-INF/").

Throws: IOException if an IO error occurs when reading the entry

getNextJarEntry

public JarEntry getNextJarEntry()
Returns the next jar entry or null when there are no more entries.

Throws: IOException if an IO error occurs when reading the entry

read

public int read(byte[] buf, int off, int len)
XXX

Parameters: buf XXX off XXX len XXX

Returns: XXX

Throws: IOException XXX