Package java.util.zip

Class ZipFile

java.lang.Object
java.util.zip.ZipFile
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
JarFile

public class ZipFile
extends Object
implements Closeable
This class provides random read access to a zip file. You pay more to read the zip file's central directory up front (from the constructor), but if you're using getEntry(java.lang.String) to look up multiple files by name, you get the benefit of this index.

If you only want to iterate through all the files (using entries(), you should consider ZipInputStream, which provides stream-like read access to a zip file and has a lower up-front cost because you don't pay to build an in-memory index.

If you want to create a zip file, use ZipOutputStream. There is no API for updating an existing zip file.