| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
InputStream in = …;
JarInputStream jis = new JarInputStream(in);
Based on 18 examples
public class JarInputStream extends ZipInputStream
The JarInputStream
class is used to read the contents of
a JAR file from any input stream. It extends the class
java.util.zip.ZipInputStream
with support for reading
an optional Manifest
entry. The Manifest
can be used to store meta-information about the JAR file and its entries.
Field Summary |
---|
Fields inherited from class java.util.zip.InflaterInputStream |
---|
buf, inf, len |
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
Creates a new JarInputStream and reads the optional
manifest.
|
|
JarInputStream(InputStream in, boolean verify) Creates a new JarInputStream and reads the optional
manifest.
|
Method Summary | |
---|---|
protected ZipEntry |
createZipEntry(String name) Creates a new JarEntry (ZipEntry ) for the
specified JAR file entry name.
|
Manifest |
Returns the Manifest for this JAR file, or
null if none.
|
ZipEntry |
Reads the next ZIP file entry and positions the stream at the beginning of the entry data. |
JarEntry |
Reads the next JAR file entry and positions the stream at the beginning of the entry data. |
int |
read(byte[] b, int off, int len) Reads from the current JAR file entry into an array of bytes. |
Methods inherited from class java.util.zip.ZipInputStream |
---|
available, close, closeEntry, createZipEntry, getNextEntry, read, skip |
Methods inherited from class java.util.zip.InflaterInputStream |
---|
available, close, fill, mark, markSupported, read, read, reset, skip |
Methods inherited from class java.io.FilterInputStream |
---|
available, close, mark, markSupported, read, read, read, reset, skip |
Methods inherited from class java.io.InputStream |
---|
available, close, mark, markSupported, read, read, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JarInputStream(InputStream in) throws IOException
JarInputStream
and reads the optional
manifest. If a manifest is present, also attempts to verify
the signatures if the JarInputStream is signed.
in
- the actual input streamIOException
- if an I/O error has occurredpublic JarInputStream(InputStream in, boolean verify) throws IOException
JarInputStream
and reads the optional
manifest. If a manifest is present and verify is true, also attempts
to verify the signatures if the JarInputStream is signed.
in
- the actual input streamverify
- whether or not to verify the JarInputStream if
it is signed.IOException
- if an I/O error has occurredMethod Detail |
---|
protected ZipEntry createZipEntry(String name)
JarEntry
(ZipEntry
) for the
specified JAR file entry name. The manifest attributes of
the specified JAR file entry name will be copied to the new
JarEntry
.
createZipEntry
in class ZipInputStream
name
- the name of the JAR/ZIP file entryJarEntry
object just createdpublic Manifest getManifest()
Manifest
for this JAR file, or
null
if none.
Manifest
for this JAR file, or
null
if none.public ZipEntry getNextEntry() throws IOException
getNextEntry
in class ZipInputStream
IOException
- if an I/O error has occurredpublic JarEntry getNextJarEntry() throws IOException
IOException
- if an I/O error has occurredpublic int read(byte[] b, int off, int len) throws IOException
len
is not zero, the method
blocks until some input is available; otherwise, no
bytes are read and 0
is returned.
If verification has been enabled, any invalid signature
on the current entry will be reported at some point before the
end of the entry is reached.
read
in class ZipInputStream
b
- the buffer into which the data is readoff
- the start offset in the destination array b
len
- the maximum number of bytes to readIOException
- if an I/O error has occurred
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |