java.util.zip
public class ZipFile extends Object implements ZipConstants
Field Summary | |
---|---|
static int | OPEN_DELETE
Mode flag to delete a zip file after reading. |
static int | OPEN_READ
Mode flag to open a zip file for reading. |
Constructor Summary | |
---|---|
ZipFile(String name)
Opens a Zip file with the given name for reading. | |
ZipFile(File file)
Opens a Zip file reading the given File. | |
ZipFile(File file, int mode)
Opens a Zip file reading the given File in the given mode.
|
Method Summary | |
---|---|
void | close()
Closes the ZipFile. |
Enumeration<? extends ZipEntry> | entries()
Returns an enumeration of all Zip entries in this Zip file.
|
protected void | finalize()
Calls the close() method when this ZipFile has not yet
been explicitly closed. |
ZipEntry | getEntry(String name)
Searches for a zip entry in this archive with the given name.
|
InputStream | getInputStream(ZipEntry entry)
Creates an input stream reading the given zip entry as
uncompressed data. |
String | getName()
Returns the (path) name of this zip file. |
int | size()
Returns the number of entries in this zip file.
|
Throws: IOException if a i/o error occured. ZipException if the file doesn't contain a valid zip archive.
Throws: IOException if a i/o error occured. ZipException if the file doesn't contain a valid zip archive.
Parameters: mode Must be one of OPEN_READ or OPEN_READ | OPEN_DELETE
Throws: IOException if a i/o error occured. ZipException if the file doesn't contain a valid zip archive.
Since: JDK1.3
Throws: IOException if a i/o error occured.
Throws: IllegalStateException when the ZipFile has already been closed
close()
method when this ZipFile has not yet
been explicitly closed.Parameters: name the name. May contain directory components separated by slashes ('/').
Returns: the zip entry, or null if no entry with that name exists.
Throws: IllegalStateException when the ZipFile has already been closed
Parameters: entry the entry to create an InputStream for.
Returns: the input stream, or null if the requested entry does not exist.
Throws: IllegalStateException when the ZipFile has already been closed IOException if a i/o error occured. ZipException if the Zip archive is malformed.
Throws: IllegalStateException when the ZipFile has already been closed