Java™ Platform
Standard Ed. 8
compact1, compact2, compact3
java.util.zip
Class ZipInputStream
-
- All Implemented Interfaces:
- Closeable, AutoCloseable
- Direct Known Subclasses:
- JarInputStream
public class ZipInputStream
extends InflaterInputStream
This class implements an input stream filter for reading files in the
ZIP file format. Includes support for both compressed and uncompressed
entries.
-
-
Method Summary
All Methods Instance Methods Concrete Methods
| Modifier and Type |
Method |
Description |
int |
available() |
Returns 0 after EOF has reached for the current entry data,
otherwise always return 1.
|
void |
close() |
Closes this input stream and releases any system resources associated
with the stream.
|
void |
closeEntry() |
Closes the current ZIP entry and positions the stream for reading the
next entry.
|
protected ZipEntry |
createZipEntry(String name) |
Creates a new ZipEntry object for the specified
entry name.
|
ZipEntry |
getNextEntry() |
Reads the next ZIP file entry and positions the stream at the
beginning of the entry data.
|
int |
read(byte[] b,
int off,
int len) |
Reads from the current ZIP entry into an array of bytes.
|
long |
skip(long n) |
Skips specified number of bytes in the current ZIP entry.
|
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
read
public int read(byte[] b,
int off,
int len)
throws IOException
Reads from the current ZIP entry into an array of bytes.
If len is not zero, the method
blocks until some input is available; otherwise, no
bytes are read and 0 is returned.
- Overrides:
read in class InflaterInputStream
- Parameters:
b - the buffer into which the data is read
off - the start offset in the destination array b
len - the maximum number of bytes read
- Returns:
- the actual number of bytes read, or -1 if the end of the
entry is reached
- Throws:
NullPointerException - if b is null.
IndexOutOfBoundsException - if off is negative,
len is negative, or len is greater than
b.length - off
ZipException - if a ZIP file error has occurred
IOException - if an I/O error has occurred
- See Also:
FilterInputStream.in
Java™ Platform
Standard Ed. 8
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.