Package java.util.jar
Class JarInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
java.util.zip.InflaterInputStream
java.util.zip.ZipInputStream
java.util.jar.JarInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
public class JarInputStream extends ZipInputStream
The input stream from which the JAR file to be read may be fetched. It is
used like the
ZipInputStream.- See Also:
ZipInputStream
-
Field Summary
Fields Modifier and Type Field Description static intCENATTstatic intCENATXstatic intCENCOMstatic intCENCRCstatic intCENDSKstatic intCENEXTstatic intCENFLGstatic intCENHDRstatic intCENHOWstatic intCENLENstatic intCENNAMstatic intCENOFFstatic longCENSIGstatic intCENSIZstatic intCENTIMstatic intCENVEMstatic intCENVERstatic intENDCOMstatic intENDHDRstatic intENDOFFstatic longENDSIGstatic intENDSIZstatic intENDSUBstatic intENDTOTstatic intEXTCRCstatic intEXTHDRstatic intEXTLENstatic longEXTSIGstatic intEXTSIZstatic intLOCCRCstatic intLOCEXTstatic intLOCFLGstatic intLOCHDRstatic intLOCHOWstatic intLOCLENstatic intLOCNAMstatic longLOCSIGstatic intLOCSIZstatic intLOCTIMstatic intLOCVERFields inherited from class java.util.zip.InflaterInputStream
buf, inf, lenFields inherited from class java.io.FilterInputStream
in -
Constructor Summary
Constructors Constructor Description JarInputStream(InputStream stream)Constructs a newJarInputStreamfrom an input stream.JarInputStream(InputStream stream, boolean verify)Constructs a newJarInputStreamfrom an input stream. -
Method Summary
Modifier and Type Method Description protected ZipEntrycreateZipEntry(String name)creates aZipEntrywith the given name.ManifestgetManifest()Returns theManifestobject associated with thisJarInputStreamornullif no manifest entry exists.ZipEntrygetNextEntry()Returns the nextZipEntrycontained in this stream ornullif no more entries are present.JarEntrygetNextJarEntry()Returns the nextJarEntrycontained in this stream ornullif no more entries are present.intread(byte[] buffer, int byteOffset, int byteCount)Reads up tobyteCountbytes of decompressed data and stores it inbufferstarting atbyteOffset.Methods inherited from class java.util.zip.ZipInputStream
available, close, closeEntryMethods inherited from class java.util.zip.InflaterInputStream
fill, mark, markSupported, read, reset, skipMethods inherited from class java.io.InputStream
read
-
Field Details
-
LOCSIG
static final long LOCSIG- See Also:
- Constant Field Values
-
EXTSIG
static final long EXTSIG- See Also:
- Constant Field Values
-
CENSIG
static final long CENSIG- See Also:
- Constant Field Values
-
ENDSIG
static final long ENDSIG- See Also:
- Constant Field Values
-
LOCHDR
static final int LOCHDR- See Also:
- Constant Field Values
-
EXTHDR
static final int EXTHDR- See Also:
- Constant Field Values
-
CENHDR
static final int CENHDR- See Also:
- Constant Field Values
-
ENDHDR
static final int ENDHDR- See Also:
- Constant Field Values
-
LOCVER
static final int LOCVER- See Also:
- Constant Field Values
-
LOCFLG
static final int LOCFLG- See Also:
- Constant Field Values
-
LOCHOW
static final int LOCHOW- See Also:
- Constant Field Values
-
LOCTIM
static final int LOCTIM- See Also:
- Constant Field Values
-
LOCCRC
static final int LOCCRC- See Also:
- Constant Field Values
-
LOCSIZ
static final int LOCSIZ- See Also:
- Constant Field Values
-
LOCLEN
static final int LOCLEN- See Also:
- Constant Field Values
-
LOCNAM
static final int LOCNAM- See Also:
- Constant Field Values
-
LOCEXT
static final int LOCEXT- See Also:
- Constant Field Values
-
EXTCRC
static final int EXTCRC- See Also:
- Constant Field Values
-
EXTSIZ
static final int EXTSIZ- See Also:
- Constant Field Values
-
EXTLEN
static final int EXTLEN- See Also:
- Constant Field Values
-
CENVEM
static final int CENVEM- See Also:
- Constant Field Values
-
CENVER
static final int CENVER- See Also:
- Constant Field Values
-
CENFLG
static final int CENFLG- See Also:
- Constant Field Values
-
CENHOW
static final int CENHOW- See Also:
- Constant Field Values
-
CENTIM
static final int CENTIM- See Also:
- Constant Field Values
-
CENCRC
static final int CENCRC- See Also:
- Constant Field Values
-
CENSIZ
static final int CENSIZ- See Also:
- Constant Field Values
-
CENLEN
static final int CENLEN- See Also:
- Constant Field Values
-
CENNAM
static final int CENNAM- See Also:
- Constant Field Values
-
CENEXT
static final int CENEXT- See Also:
- Constant Field Values
-
CENCOM
static final int CENCOM- See Also:
- Constant Field Values
-
CENDSK
static final int CENDSK- See Also:
- Constant Field Values
-
CENATT
static final int CENATT- See Also:
- Constant Field Values
-
CENATX
static final int CENATX- See Also:
- Constant Field Values
-
CENOFF
static final int CENOFF- See Also:
- Constant Field Values
-
ENDSUB
static final int ENDSUB- See Also:
- Constant Field Values
-
ENDTOT
static final int ENDTOT- See Also:
- Constant Field Values
-
ENDSIZ
static final int ENDSIZ- See Also:
- Constant Field Values
-
ENDOFF
static final int ENDOFF- See Also:
- Constant Field Values
-
ENDCOM
static final int ENDCOM- See Also:
- Constant Field Values
-
-
Constructor Details
-
JarInputStream
Constructs a newJarInputStreamfrom an input stream.- Parameters:
stream- the input stream containing the JAR file.verify- if the file should be verified with aJarVerifier.- Throws:
IOException- If an error occurs reading entries from the input stream.- See Also:
ZipInputStream(InputStream)
-
JarInputStream
Constructs a newJarInputStreamfrom an input stream.- Parameters:
stream- the input stream containing the JAR file.- Throws:
IOException- If an error occurs reading entries from the input stream.- See Also:
ZipInputStream(InputStream)
-
-
Method Details
-
getManifest
Returns theManifestobject associated with thisJarInputStreamornullif no manifest entry exists.- Returns:
- the MANIFEST specifying the contents of the JAR file.
-
getNextJarEntry
Returns the nextJarEntrycontained in this stream ornullif no more entries are present.- Returns:
- the next JAR entry.
- Throws:
IOException- if an error occurs while reading the entry.
-
read
Reads up tobyteCountbytes of decompressed data and stores it inbufferstarting atbyteOffset. Returns the number of uncompressed bytes read.- Overrides:
readin classZipInputStream- Throws:
IOException- if an IOException occurs.
-
getNextEntry
Returns the nextZipEntrycontained in this stream ornullif no more entries are present.- Overrides:
getNextEntryin classZipInputStream- Returns:
- the next extracted ZIP entry.
- Throws:
IOException- if an error occurs while reading the entry.
-
createZipEntry
Description copied from class:ZipInputStreamcreates aZipEntrywith the given name.- Overrides:
createZipEntryin classZipInputStream- Parameters:
name- the name of the entry.- Returns:
- the created
ZipEntry.
-