open class ZipInputStream : InflaterInputStream
Known Direct Subclasses
| JarInputStream |
The JarInputStream class is used to read the contents of a JAR file from any input stream.
|
|
This class implements an input stream filter for reading files in the ZIP file format. Includes support for both compressed and uncompressed entries.
Summary
| Public constructors |
|
Creates a new ZIP input stream.
|
|
Creates a new ZIP input stream.
|
| Public methods |
| open Int |
Returns 0 after EOF has reached for the current entry data, otherwise always return 1.
|
| open Unit |
Closes this input stream and releases any system resources associated with the stream.
|
| open Unit |
Closes the current ZIP entry and positions the stream for reading the next entry.
|
| open ZipEntry! |
Reads the next ZIP file entry and positions the stream at the beginning of the entry data.
|
| open Int |
Reads from the current ZIP entry into an array of bytes.
|
| open Long |
Skips specified number of bytes in the current ZIP entry.
|
| Protected methods |
| open ZipEntry! |
Creates a new ZipEntry object for the specified entry name.
|
| Inherited functions |
From class InflaterInputStream
Unit |
fill()
Fills input buffer with more data to decompress.
|
Unit |
mark(readlimit: Int)
Marks the current position in this input stream.
The mark method of InflaterInputStream does nothing.
|
Boolean |
markSupported()
Tests if this input stream supports the mark and reset methods. The markSupported method of InflaterInputStream returns false.
|
Int |
read()
Reads a byte of uncompressed data. This method will block until enough input is available for decompression.
|
Unit |
reset()
Repositions this stream to the position at the time the mark method was last called on this input stream.
The method reset for class InflaterInputStream does nothing except throw an IOException.
|
|
From class FilterInputStream
Int |
read(b: ByteArray!)
Reads up to byte.length bytes of data from this input stream into an array of bytes. This method blocks until some input is available.
This method simply performs the call read(b, 0, b.length) and returns the result. It is important that it does not do in.read(b) instead; certain subclasses of FilterInputStream depend on the implementation strategy actually used.
|
|
Constants
CENATT
static val CENATT: Int
Value: 36
CENATX
static val CENATX: Int
Value: 38
CENCOM
static val CENCOM: Int
Value: 32
CENCRC
static val CENCRC: Int
Value: 16
CENDSK
static val CENDSK: Int
Value: 34
CENEXT
static val CENEXT: Int
Value: 30
CENFLG
static val CENFLG: Int
Value: 8
CENHDR
static val CENHDR: Int
Value: 46
CENHOW
static val CENHOW: Int
Value: 10
CENLEN
static val CENLEN: Int
Value: 24
CENNAM
static val CENNAM: Int
Value: 28
CENOFF
static val CENOFF: Int
Value: 42
CENSIG
static val CENSIG: Long
Value: 33639248L
CENSIZ
static val CENSIZ: Int
Value: 20
CENTIM
static val CENTIM: Int
Value: 12
CENVEM
static val CENVEM: Int
Value: 4
CENVER
static val CENVER: Int
Value: 6
ENDCOM
static val ENDCOM: Int
Value: 20
ENDHDR
static val ENDHDR: Int
Value: 22
ENDOFF
static val ENDOFF: Int
Value: 16
ENDSIG
static val ENDSIG: Long
Value: 101010256L
ENDSIZ
static val ENDSIZ: Int
Value: 12
ENDSUB
static val ENDSUB: Int
Value: 8
ENDTOT
static val ENDTOT: Int
Value: 10
EXTCRC
static val EXTCRC: Int
Value: 4
EXTHDR
static val EXTHDR: Int
Value: 16
EXTLEN
static val EXTLEN: Int
Value: 12
EXTSIG
static val EXTSIG: Long
Value: 134695760L
EXTSIZ
static val EXTSIZ: Int
Value: 8
LOCCRC
static val LOCCRC: Int
Value: 14
LOCEXT
static val LOCEXT: Int
Value: 28
LOCFLG
static val LOCFLG: Int
Value: 6
LOCHDR
static val LOCHDR: Int
Value: 30
LOCHOW
static val LOCHOW: Int
Value: 8
LOCLEN
static val LOCLEN: Int
Value: 22
LOCNAM
static val LOCNAM: Int
Value: 26
LOCSIG
static val LOCSIG: Long
Value: 67324752L
LOCSIZ
static val LOCSIZ: Int
Value: 18
LOCTIM
static val LOCTIM: Int
Value: 10
LOCVER
static val LOCVER: Int
Value: 4
Public constructors
<init>
ZipInputStream(in: InputStream!)
Creates a new ZIP input stream.
The UTF-8 charset is used to decode the entry names.
<init>
ZipInputStream(
in: InputStream!,
charset: Charset!)
Creates a new ZIP input stream.
Public methods
available
open fun available(): Int
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.
| Return |
Int |
1 before EOF and 0 after EOF has reached for current entry. |
| Exceptions |
java.io.IOException |
if an I/O error occurs. |
close
open fun close(): Unit
Closes this input stream and releases any system resources associated with the stream.
| Exceptions |
java.lang.Exception |
if this resource cannot be closed |
java.io.IOException |
if an I/O error occurs |
java.io.IOException |
if an I/O error has occurred |
closeEntry
open fun closeEntry(): Unit
Closes the current ZIP entry and positions the stream for reading the next entry.
| Exceptions |
java.util.zip.ZipException |
if a ZIP file error has occurred |
java.io.IOException |
if an I/O error has occurred |
getNextEntry
open fun getNextEntry(): ZipEntry!
Reads the next ZIP file entry and positions the stream at the beginning of the entry data.
| Return |
ZipEntry! |
the next ZIP file entry, or null if there are no more entries |
| Exceptions |
java.util.zip.ZipException |
if a ZIP file error has occurred |
java.io.IOException |
if an I/O error has occurred |
read
open fun read(
b: ByteArray!,
off: Int,
len: Int
): Int
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.
| Parameters |
b |
ByteArray!: the buffer into which the data is read |
off |
Int: the start offset in the destination array b |
len |
Int: the maximum number of bytes read |
| Return |
Int |
the actual number of bytes read, or -1 if the end of the entry is reached |
| Exceptions |
java.lang.NullPointerException |
if b is null. |
java.lang.IndexOutOfBoundsException |
if off is negative, len is negative, or len is greater than b.length - off |
java.util.zip.ZipException |
if a ZIP file error has occurred |
java.io.IOException |
if an I/O error has occurred |
skip
open fun skip(n: Long): Long
Skips specified number of bytes in the current ZIP entry.
| Parameters |
n |
Long: the number of bytes to skip |
| Return |
Long |
the actual number of bytes skipped |
| Exceptions |
java.util.zip.ZipException |
if a ZIP file error has occurred |
java.io.IOException |
if an I/O error has occurred |
java.lang.IllegalArgumentException |
if n < 0 |
Protected methods
createZipEntry
protected open fun createZipEntry(name: String!): ZipEntry!
Creates a new ZipEntry object for the specified entry name.
| Parameters |
name |
String!: the ZIP file entry name |
| Return |
ZipEntry! |
the ZipEntry just created |