Class java.util.zip.ZipFile
All Packages Class Hierarchy This Package Previous Next Index
Class java.util.zip.ZipFile
Object
|
+----java.util.zip.ZipFile
- public class ZipFile
- extends Object
- implements ZipConstants
This class can be used to read the contents of a ZIP file. It uses
RandomAccessFile for quick access to ZIP file entries, and supports
both compressed and uncompressed entries.
- Version:
- 1.18, 01/24/97
- Author:
- David Connelly
-
java.util.zip.ZipFile(String)
- Opens a ZIP file for reading given the specified file name.
-
java.util.zip.ZipFile(File)
- Opens a ZIP file for reading given the specified File object.
-
close()
- Closes the ZIP file.
-
entries()
- Returns an enumeration of the ZIP file entries.
-
getEntry(String)
- Returns the ZIP file entry for the given path name.
-
getInputStream(ZipEntry)
- Returns an input stream for reading the contents of the specified
ZIP file entry.
-
getName()
- Returns the path name of the ZIP file.
ZipFile
public ZipFile(String name) throws IOException
- Opens a ZIP file for reading given the specified file name.
- Parameters:
- name - the name of the zip file
- Throws: ZipException
- if a ZIP format error has occurred
- Throws: IOException
- if an I/O error has occurred
ZipFile
public ZipFile(File file) throws ZipException, IOException
- Opens a ZIP file for reading given the specified File object.
- Parameters:
- file - the ZIP file to be opened for reading
- Throws: ZipException
- if a ZIP error has occurred
- Throws: IOException
- if an I/O error has occurred
close
public void close() throws IOException
- Closes the ZIP file.
entries
public java.util.Enumeration entries()
- Returns an enumeration of the ZIP file entries.
getEntry
public java.util.zip.ZipEntry getEntry(String name)
- Returns the ZIP file entry for the given path name. Returns null if
there is no entry corresponding to the given name.
- Parameters:
- name - the name of the entry
- Returns:
- the ZIP file entry
getInputStream
public java.io.InputStream getInputStream(ZipEntry ze) throws IOException
- Returns an input stream for reading the contents of the specified
ZIP file entry.
- Parameters:
- ze - the zip file entry
- Throws: ZipException
- if a ZIP format error has occurred
- Throws: IOException
- if an I/O error has occurred
getName
public java.lang.String getName()
- Returns the path name of the ZIP file.
All Packages Class Hierarchy This Package Previous Next Index