Android
java.util.jar
public class

java.util.jar.JarFile

java.lang.Object
java.util.zip.ZipFile
java.util.jar.JarFile

JarFile is used to read jar entries and their associated data from jar files.

Summary

Constants

      Value  
String  MANIFEST_NAME    "META-INF/MANIFEST.MF" 
Constants inherited from class java.util.zip.ZipFile

Public Constructors

            JarFile(File file)
Create a new JarFile using the contents of file.
            JarFile(File file, boolean verify)
Create a new JarFile using the contents of file.
            JarFile(File file, boolean verify, int mode)
Create a new JarFile using the contents of file.
            JarFile(String filename)
Create a new JarFile from the contents of the file specified by filename.
            JarFile(String filename, boolean verify)
Create a new JarFile from the contents of the file specified by filename.

Public Methods

          void  close()
Close the Zip file.
          Enumeration<JarEntry entries()
Return an enumeration containing the JarEntrys contained in this JarFile.
          ZipEntry  getEntry(String name)
Return the JarEntry specified by name or null if no such entry exists
          InputStream  getInputStream(ZipEntry ze)
Return an InputStream for reading the decompressed contents of ze.
          JarEntry  getJarEntry(String name)
Return the JarEntry specified by name or null if no such entry exists.
          Manifest  getManifest()
Returns the Manifest object associated with this JarFile or null if no manifest entry exists.
Methods inherited from class java.util.zip.ZipFile
Methods inherited from class java.lang.Object

Details

Constants

public static final String MANIFEST_NAME

Constant Value: "META-INF/MANIFEST.MF"

Public Constructors

public JarFile(File file)

Create a new JarFile using the contents of file.

Parameters

file java.io.File

Throws

IOException If the file cannot be read.

public JarFile(File file, boolean verify)

Create a new JarFile using the contents of file.

Parameters

file java.io.File
verify verify a signed jar file

Throws

IOException If the file cannot be read.

public JarFile(File file, boolean verify, int mode)

Create a new JarFile using the contents of file.

Parameters

file java.io.File
verify verify a signed jar file
mode the mode to use, either OPEN_READ or OPEN_READ | OPEN_DELETE

Throws

IOException If the file cannot be read.

public JarFile(String filename)

Create a new JarFile from the contents of the file specified by filename.

Parameters

filename java.lang.String

Throws

IOException If fileName cannot be opened for reading.

public JarFile(String filename, boolean verify)

Create a new JarFile from the contents of the file specified by filename.

Parameters

filename java.lang.String
verify verify a signed jar file

Throws

IOException If fileName cannot be opened for reading.

Public Methods

public void close()

Close the Zip file. This could be called multiple times, e.g. once explicitly and again by the finalizer. The Java doc doesn't say anything about what operations like entries() or getName() are supposed to do after the file is closed.

Throws

IOException

public Enumeration<JarEntry> entries()

Return an enumeration containing the JarEntrys contained in this JarFile.

Returns

  • java.util.Enumeration

Throws

IllegalStateException If this JarFile has been closed.

public ZipEntry getEntry(String name)

Return the JarEntry specified by name or null if no such entry exists

Parameters

name the name of the entry in the jar file

Returns

  • java.util.jar.JarEntry

public InputStream getInputStream(ZipEntry ze)

Return an InputStream for reading the decompressed contents of ze.

Parameters

ze the ZipEntry to read from

Returns

  • java.io.InputStream

Throws

IOException If an error occured while creating the InputStream.

public JarEntry getJarEntry(String name)

Return the JarEntry specified by name or null if no such entry exists.

Parameters

name the name of the entry in the jar file

Returns

  • java.util.jar.JarEntry

public Manifest getManifest()

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

Returns

  • java.util.jar.Manifest

Throws

IOException
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56