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 theZipInputStream.- 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 intLOCVER-
Fields inherited from class java.util.zip.InflaterInputStream
buf, inf, len
-
Fields 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseEntry()Closes the current zip entry and prepares to read the next entry.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
-
Methods inherited from class java.util.zip.InflaterInputStream
fill, mark, markSupported, read, reset, skip
-
Methods inherited from class java.io.InputStream
read
-
-
-
-
Field Detail
-
LOCSIG
public static final long LOCSIG
- See Also:
- Constant Field Values
-
EXTSIG
public static final long EXTSIG
- See Also:
- Constant Field Values
-
CENSIG
public static final long CENSIG
- See Also:
- Constant Field Values
-
ENDSIG
public static final long ENDSIG
- See Also:
- Constant Field Values
-
LOCHDR
public static final int LOCHDR
- See Also:
- Constant Field Values
-
EXTHDR
public static final int EXTHDR
- See Also:
- Constant Field Values
-
CENHDR
public static final int CENHDR
- See Also:
- Constant Field Values
-
ENDHDR
public static final int ENDHDR
- See Also:
- Constant Field Values
-
LOCVER
public static final int LOCVER
- See Also:
- Constant Field Values
-
LOCFLG
public static final int LOCFLG
- See Also:
- Constant Field Values
-
LOCHOW
public static final int LOCHOW
- See Also:
- Constant Field Values
-
LOCTIM
public static final int LOCTIM
- See Also:
- Constant Field Values
-
LOCCRC
public static final int LOCCRC
- See Also:
- Constant Field Values
-
LOCSIZ
public static final int LOCSIZ
- See Also:
- Constant Field Values
-
LOCLEN
public static final int LOCLEN
- See Also:
- Constant Field Values
-
LOCNAM
public static final int LOCNAM
- See Also:
- Constant Field Values
-
LOCEXT
public static final int LOCEXT
- See Also:
- Constant Field Values
-
EXTCRC
public static final int EXTCRC
- See Also:
- Constant Field Values
-
EXTSIZ
public static final int EXTSIZ
- See Also:
- Constant Field Values
-
EXTLEN
public static final int EXTLEN
- See Also:
- Constant Field Values
-
CENVEM
public static final int CENVEM
- See Also:
- Constant Field Values
-
CENVER
public static final int CENVER
- See Also:
- Constant Field Values
-
CENFLG
public static final int CENFLG
- See Also:
- Constant Field Values
-
CENHOW
public static final int CENHOW
- See Also:
- Constant Field Values
-
CENTIM
public static final int CENTIM
- See Also:
- Constant Field Values
-
CENCRC
public static final int CENCRC
- See Also:
- Constant Field Values
-
CENSIZ
public static final int CENSIZ
- See Also:
- Constant Field Values
-
CENLEN
public static final int CENLEN
- See Also:
- Constant Field Values
-
CENNAM
public static final int CENNAM
- See Also:
- Constant Field Values
-
CENEXT
public static final int CENEXT
- See Also:
- Constant Field Values
-
CENCOM
public static final int CENCOM
- See Also:
- Constant Field Values
-
CENDSK
public static final int CENDSK
- See Also:
- Constant Field Values
-
CENATT
public static final int CENATT
- See Also:
- Constant Field Values
-
CENATX
public static final int CENATX
- See Also:
- Constant Field Values
-
CENOFF
public static final int CENOFF
- See Also:
- Constant Field Values
-
ENDSUB
public static final int ENDSUB
- See Also:
- Constant Field Values
-
ENDTOT
public static final int ENDTOT
- See Also:
- Constant Field Values
-
ENDSIZ
public static final int ENDSIZ
- See Also:
- Constant Field Values
-
ENDOFF
public static final int ENDOFF
- See Also:
- Constant Field Values
-
ENDCOM
public static final int ENDCOM
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JarInputStream
public JarInputStream(InputStream stream, boolean verify) throws IOException
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
public JarInputStream(InputStream stream) throws IOException
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 Detail
-
getManifest
public Manifest getManifest()
Returns theManifestobject associated with thisJarInputStreamornullif no manifest entry exists.- Returns:
- the MANIFEST specifying the contents of the JAR file.
-
getNextJarEntry
public JarEntry getNextJarEntry() throws IOException
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
public int read(byte[] buffer, int byteOffset, int byteCount) throws IOExceptionReads 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
public ZipEntry getNextEntry() throws IOException
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.
-
closeEntry
public void closeEntry() throws IOExceptionDescription copied from class:ZipInputStreamCloses the current zip entry and prepares to read the next entry.- Overrides:
closeEntryin classZipInputStream- Throws:
IOException- if anIOExceptionoccurs.
-
createZipEntry
protected ZipEntry createZipEntry(String name)
Description copied from class:ZipInputStreamcreates aZipEntrywith the given name.- Overrides:
createZipEntryin classZipInputStream- Parameters:
name- the name of the entry.- Returns:
- the created
ZipEntry.
-
-