JarInputStream - JRE Emulation | JRE Emulation
public class

JarInputStream

extends ZipInputStream
java.lang.Object
   ↳ java.io.InputStream
     ↳ java.io.FilterInputStream
       ↳ java.util.zip.InflaterInputStream
         ↳ java.util.zip.ZipInputStream
           ↳ java.util.jar.JarInputStream

Class Overview

The input stream from which the JAR file to be read may be fetched. It is used like the ZipInputStream.

See Also

Summary

[Expand]
Inherited Constants
From class java.util.zip.ZipInputStream
[Expand]
Inherited Fields
From class java.util.zip.InflaterInputStream
From class java.io.FilterInputStream
Public Constructors
JarInputStream(InputStream stream, boolean verify)
Constructs a new JarInputStream from an input stream.
JarInputStream(InputStream stream)
Constructs a new JarInputStream from an input stream.
Public Methods
void closeEntry()
Closes the current zip entry and prepares to read the next entry.
Manifest getManifest()
Returns the Manifest object associated with this JarInputStream or null if no manifest entry exists.
ZipEntry getNextEntry()
Returns the next ZipEntry contained in this stream or null if no more entries are present.
JarEntry getNextJarEntry()
Returns the next JarEntry contained in this stream or null if no more entries are present.
int read(byte[] buffer, int byteOffset, int byteCount)
Reads up to byteCount bytes of decompressed data and stores it in buffer starting at byteOffset.
Protected Methods
ZipEntry createZipEntry(String name)
creates a ZipEntry with the given name.
Inherited Methods
[Expand]
From class java.util.zip.ZipInputStream
From class java.util.zip.InflaterInputStream
From class java.io.FilterInputStream
From class java.io.InputStream
From class java.lang.Object
From interface java.io.Closeable
From interface java.lang.AutoCloseable

Public Constructors

public JarInputStream (InputStream stream, boolean verify)

Constructs a new JarInputStream from an input stream.

Parameters
stream the input stream containing the JAR file.
verify if the file should be verified with a JarVerifier.
Throws
IOException If an error occurs reading entries from the input stream.

public JarInputStream (InputStream stream)

Constructs a new JarInputStream from an input stream.

Parameters
stream the input stream containing the JAR file.
Throws
IOException If an error occurs reading entries from the input stream.

Public Methods

public void closeEntry ()

Closes the current zip entry and prepares to read the next entry.

Throws
IOException

public Manifest getManifest ()

Returns the Manifest object associated with this JarInputStream or null if no manifest entry exists.

Returns
  • the MANIFEST specifying the contents of the JAR file.

public ZipEntry getNextEntry ()

Returns the next ZipEntry contained in this stream or null if no more entries are present.

Returns
  • the next extracted ZIP entry.
Throws
IOException if an error occurs while reading the entry.

public JarEntry getNextJarEntry ()

Returns the next JarEntry contained in this stream or null if no more entries are present.

Returns
  • the next JAR entry.
Throws
IOException if an error occurs while reading the entry.

public int read (byte[] buffer, int byteOffset, int byteCount)

Reads up to byteCount bytes of decompressed data and stores it in buffer starting at byteOffset. Returns the number of uncompressed bytes read.

Parameters
buffer the buffer into which the data is read.
byteOffset the start offset in the destination array b
byteCount the maximum number of bytes read.
Returns
  • the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Throws
IOException if an IOException occurs.

Protected Methods

protected ZipEntry createZipEntry (String name)

creates a ZipEntry with the given name.

Parameters
name the name of the entry.
Returns
  • the created ZipEntry.