Android APIs
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.
[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
From interface java.lang.AutoCloseable

Public Constructors

public JarInputStream (InputStream stream, boolean verify)

Added in 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)

Added in 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 void closeEntry ()

Added in API level 1

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

Throws
IOException

public Manifest getManifest ()

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

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

Added in 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 byteOffset, int byteCount)

Added in API level 1

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

Throws
IOException if an IOException occurs.

Protected Methods

protected ZipEntry createZipEntry (String name)

Added in API level 1

creates a ZipEntry with the given name.

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