Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Class java.util.zip.ZipFile

java.lang.Object
    |
    +----java.util.zip.ZipFile
Subclasses:
JarFile

public class ZipFile
extends Object
implements java.util.zip.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.


Constructor Summary
 ZipFile()
Creates a ne w ZIP file with no name.
 ZipFile(String name)
Opens a ZIP file for reading given the specified file name.
 ZipFile(File file)
Opens a ZIP file for reading given the specified File object.
 

Method Summary
void  close()
Closes the ZIP file.
ZipEntry  createZipEntry(String name)
Creates a new ZipEntry object for the specified entry name.
Enumeration  entries()
Returns an enumeration of the ZIP file entries.
ZipEntry  getEntry(String name)
Returns the ZIP file entry for the given path name.
InputStream  getInputStream(ZipEntry ze)
Returns an input stream for reading the contents of the specified ZIP file entry.
String  getName()
Returns the path name of the ZIP file.
int  size()
Returns the number of entry in the ZIP file.
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZipFile

protected ZipFile()
Creates a ne w ZIP file with no name.

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
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
IOException - if an I/O error has occurred
Method Detail

getEntry

public 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 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
IOException - if an I/O error has occurred

getName

public String getName()
Returns the path name of the ZIP file.

entries

public Enumeration entries()
Returns an enumeration of the ZIP file entries.

size

public int size()
Returns the number of entry in the ZIP file.

close

public void close() throws IOException
Closes the ZIP file.

createZipEntry

protected ZipEntry createZipEntry(String name)
Creates a new ZipEntry object for the specified entry name.
Parameters:
name - the ZIP file entry name

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.