open class GZIPInputStream : InflaterInputStream
This class implements a stream filter for reading compressed data in the GZIP file format.
Summary
Constants
|
| static Int |
GZIP header magic number.
|
Public constructors
|
|
Creates a new input stream with the specified buffer size.
|
|
Creates a new input stream with a default buffer size.
|
Public methods
|
| open Unit |
Closes this input stream and releases any system resources associated with the stream.
|
| open Int |
Reads uncompressed data into an array of bytes.
|
Inherited functions
|
From class InflaterInputStream
Int |
available()
Returns 0 after EOF has been reached, otherwise always return 1.
Programs should not count on this method to return the actual number of bytes that could be read without blocking.
|
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.
|
Long |
skip(n: Long)
Skips specified number of bytes of uncompressed data.
|
|
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.
|
|
Properties
|
| CRC32! |
CRC-32 for uncompressed data.
|
| Boolean |
Indicates end of input stream.
|
Constants
GZIP_MAGIC
static val GZIP_MAGIC: Int
GZIP header magic number.
Value: 35615
Public constructors
<init>
GZIPInputStream(
in: InputStream!,
size: Int)
Creates a new input stream with the specified buffer size.
| Parameters |
in |
InputStream!: the input stream |
size |
Int: the input buffer size |
| Exceptions |
java.util.zip.ZipException |
if a GZIP format error has occurred or the compression method used is unsupported |
java.io.IOException |
if an I/O error has occurred |
java.lang.IllegalArgumentException |
if size <= 0 |
<init>
GZIPInputStream(in: InputStream!)
Creates a new input stream with a default buffer size.
| Exceptions |
java.util.zip.ZipException |
if a GZIP format error has occurred or the compression method used is unsupported |
java.io.IOException |
if an I/O error has occurred |
Public methods
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 |
read
open fun read(
buf: ByteArray!,
off: Int,
len: Int
): Int
Reads uncompressed data into an array of bytes. If len is not zero, the method will block until some input can be decompressed; otherwise, no bytes are read and 0 is returned.
| Parameters |
b |
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 |
buf |
ByteArray!: the buffer into which the data is read |
| Return |
Int |
the actual number of bytes read, or -1 if the end of the compressed input stream is reached |
| Exceptions |
java.lang.NullPointerException |
If buf is null. |
java.lang.IndexOutOfBoundsException |
If off is negative, len is negative, or len is greater than buf.length - off |
java.util.zip.ZipException |
if the compressed input data is corrupt. |
java.io.IOException |
if an I/O error has occurred. |
Properties
crc
protected var crc: CRC32!
CRC-32 for uncompressed data.
eos
protected var eos: Boolean
Indicates end of input stream.