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
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 offset, int length)
Reads up to length of decompressed data and stores it in buffer starting at offset.
Protected Methods
ZipEntry createZipEntry(String name)
creates a ZipEntry with the given name.
[Expand]
Inherited Methods
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

Public Constructors

public JarInputStream (InputStream stream, boolean verify)

Since: API Level 1

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)

Since: API Level 1

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 Manifest getManifest ()

Since: API Level 1

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 ()

Since: API Level 1

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 ()

Since: API Level 1

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 offset, int length)

Since: API Level 1

Reads up to length of decompressed data and stores it in buffer starting at offset.

Parameters
buffer Buffer to store into
offset offset in buffer to store at
length number of bytes to store
Returns
  • Number of uncompressed bytes read
Throws
IOException if an IOException occurs.

Protected Methods

protected ZipEntry createZipEntry (String name)

Since: API Level 1

creates a ZipEntry with the given name.

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