Package sk.iway.iwcm.system.zip
Class ZipInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
sk.iway.iwcm.system.zip.InflaterInputStream
sk.iway.iwcm.system.zip.ZipInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
This class implements an input stream filter for reading files in the ZIP
file format. Includes support for both compressed and uncompressed entries.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final longstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final longstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final longstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final longstatic final intstatic final intstatic final intFields inherited from class sk.iway.iwcm.system.zip.InflaterInputStream
buf, inf, lenFields inherited from class java.io.FilterInputStream
in -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns 0 after EOF has reached for the current entry data, otherwise always return 1.voidclose()Closes the ZIP input stream.voidCloses the current ZIP entry and positions the stream for reading the next entry.protected ZipEntrycreateZipEntry(String name) Creates a newZipEntryobject for the specified entry name.Reads the next ZIP file entry and positions stream at the beginning of the entry data.intread(byte[] b, int off, int len) Reads from the current ZIP entry into an array of bytes.longskip(long n) Skips specified number of bytes in the current ZIP entry.Methods inherited from class sk.iway.iwcm.system.zip.InflaterInputStream
fill, readMethods inherited from class java.io.FilterInputStream
mark, markSupported, read, resetMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
LOCSIG
static final long LOCSIG- See Also:
-
EXTSIG
static final long EXTSIG- See Also:
-
CENSIG
static final long CENSIG- See Also:
-
ENDSIG
static final long ENDSIG- See Also:
-
LOCHDR
static final int LOCHDR- See Also:
-
EXTHDR
static final int EXTHDR- See Also:
-
CENHDR
static final int CENHDR- See Also:
-
ENDHDR
static final int ENDHDR- See Also:
-
LOCVER
static final int LOCVER- See Also:
-
LOCFLG
static final int LOCFLG- See Also:
-
LOCHOW
static final int LOCHOW- See Also:
-
LOCTIM
static final int LOCTIM- See Also:
-
LOCCRC
static final int LOCCRC- See Also:
-
LOCSIZ
static final int LOCSIZ- See Also:
-
LOCLEN
static final int LOCLEN- See Also:
-
LOCNAM
static final int LOCNAM- See Also:
-
LOCEXT
static final int LOCEXT- See Also:
-
EXTCRC
static final int EXTCRC- See Also:
-
EXTSIZ
static final int EXTSIZ- See Also:
-
EXTLEN
static final int EXTLEN- See Also:
-
CENVEM
static final int CENVEM- See Also:
-
CENVER
static final int CENVER- See Also:
-
CENFLG
static final int CENFLG- See Also:
-
CENHOW
static final int CENHOW- See Also:
-
CENTIM
static final int CENTIM- See Also:
-
CENCRC
static final int CENCRC- See Also:
-
CENSIZ
static final int CENSIZ- See Also:
-
CENLEN
static final int CENLEN- See Also:
-
CENNAM
static final int CENNAM- See Also:
-
CENEXT
static final int CENEXT- See Also:
-
CENCOM
static final int CENCOM- See Also:
-
CENDSK
static final int CENDSK- See Also:
-
CENATT
static final int CENATT- See Also:
-
CENATX
static final int CENATX- See Also:
-
CENOFF
static final int CENOFF- See Also:
-
ENDSUB
static final int ENDSUB- See Also:
-
ENDTOT
static final int ENDTOT- See Also:
-
ENDSIZ
static final int ENDSIZ- See Also:
-
ENDOFF
static final int ENDOFF- See Also:
-
ENDCOM
static final int ENDCOM- See Also:
-
-
Constructor Details
-
ZipInputStream
Creates a new ZIP input stream.- Parameters:
in- the actual input stream
-
-
Method Details
-
getNextEntry
Reads the next ZIP file entry and positions stream at the beginning of the entry data.- Returns:
- the ZipEntry just read
- Throws:
ZipException- if a ZIP file error has occurredIOException- if an I/O error has occurred
-
closeEntry
Closes the current ZIP entry and positions the stream for reading the next entry.- Throws:
ZipException- if a ZIP file error has occurredIOException- if an I/O error has occurred
-
available
Returns 0 after EOF has reached for the current entry data, otherwise always return 1.Programs should not count on this method to return the actual number of bytes that could be read without blocking.
- Overrides:
availablein classInflaterInputStream- Returns:
- 1 before EOF and 0 after EOF has reached for current entry.
- Throws:
IOException- if an I/O error occurs.
-
read
Reads from the current ZIP entry into an array of bytes. Blocks until some input is available.- Overrides:
readin classInflaterInputStream- Parameters:
b- the buffer into which the data is readoff- the start offset of the datalen- the maximum number of bytes read- Returns:
- the actual number of bytes read, or -1 if the end of the entry is reached
- Throws:
ZipException- if a ZIP file error has occurredIOException- if an I/O error has occurred
-
skip
Skips specified number of bytes in the current ZIP entry.- Overrides:
skipin classInflaterInputStream- Parameters:
n- the number of bytes to skip- Returns:
- the actual number of bytes skipped
- Throws:
ZipException- if a ZIP file error has occurredIOException- if an I/O error has occurredIllegalArgumentException- if n < 0
-
close
Closes the ZIP input stream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInflaterInputStream- Throws:
IOException- if an I/O error has occurred
-
createZipEntry
Creates a newZipEntryobject for the specified entry name.- Parameters:
name- the ZIP file entry name- Returns:
- the ZipEntry just created
-