InflaterInputStream
open class InflaterInputStream : FilterInputStream
kotlin.Any | |||
↳ | java.io.InputStream | ||
↳ | java.io.FilterInputStream | ||
↳ | java.util.zip.InflaterInputStream |
This class implements a stream filter for uncompressing data in the "deflate" compression format. It is also used as the basis for other decompression filters, such as GZIPInputStream.
Summary
Public constructors | |
---|---|
InflaterInputStream(in: InputStream!, inf: Inflater!, size: Int) Creates a new input stream with the specified decompressor and buffer size. |
|
InflaterInputStream(in: InputStream!, inf: Inflater!) Creates a new input stream with the specified decompressor and a default buffer size. |
|
Creates a new input stream with a default decompressor and buffer size. |
Public methods | |
---|---|
open Int |
Returns 0 after EOF has been reached, otherwise always return 1. |
open Unit |
close() Closes this input stream and releases any system resources associated with the stream. |
open Unit |
Marks the current position in this input stream. |
open Boolean |
Tests if this input stream supports the |
open Int |
read() Reads a byte of uncompressed data. |
open Int |
Reads uncompressed data into an array of bytes. |
open Unit |
reset() Repositions this stream to the position at the time the |
open Long |
Skips specified number of bytes of uncompressed data. |
Protected methods | |
---|---|
open Unit |
fill() Fills input buffer with more data to decompress. |
Inherited functions | |
---|---|
Properties | |
---|---|
ByteArray! |
Input buffer for decompression. |
Boolean |
Indicates whether the #close() method has been called, internal use only. |
Inflater! |
Decompressor for this stream. |
Int |
Length of input buffer. |
Inherited properties | |
---|---|
Public constructors
InflaterInputStream
InflaterInputStream(
in: InputStream!,
inf: Inflater!,
size: Int)
Creates a new input stream with the specified decompressor and buffer size.
Parameters | |
---|---|
in |
InputStream!: the input stream |
inf |
Inflater!: the decompressor ("inflater") |
size |
Int: the input buffer size |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if size <= 0 |
InflaterInputStream
InflaterInputStream(
in: InputStream!,
inf: Inflater!)
Creates a new input stream with the specified decompressor and a default buffer size.
Parameters | |
---|---|
in |
InputStream!: the input stream |
inf |
Inflater!: the decompressor ("inflater") |
InflaterInputStream
InflaterInputStream(in: InputStream!)
Creates a new input stream with a default decompressor and buffer size.
Parameters | |
---|---|
in |
InputStream!: the input stream |
Public methods
available
open fun available(): Int
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.
Return | |
---|---|
Int |
1 before EOF and 0 after EOF. |
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 has occurred |
mark
open fun mark(readlimit: Int): Unit
Marks the current position in this input stream.
The mark
method of InflaterInputStream
does nothing.
Parameters | |
---|---|
readlimit |
Int: the maximum limit of bytes that can be read before the mark position becomes invalid. |
See Also
markSupported
open fun markSupported(): Boolean
Tests if this input stream supports the mark
and reset
methods. The markSupported
method of InflaterInputStream
returns false
.
Return | |
---|---|
Boolean |
a boolean indicating if this stream type supports the mark and reset methods. |
read
open fun read(): Int
Reads a byte of uncompressed data. This method will block until enough input is available for decompression.
Return | |
---|---|
Int |
the byte read, or -1 if end of compressed input is reached |
Exceptions | |
---|---|
java.io.IOException |
if an I/O error has occurred |
read
open fun read(
b: 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 |
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 compressed input is reached or a preset dictionary is needed |
Exceptions | |
---|---|
java.io.IOException |
if an I/O error has occurred |
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 format error has occurred |
reset
open fun reset(): Unit
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
.
Exceptions | |
---|---|
java.io.IOException |
if this method is invoked. |
skip
open fun skip(n: Long): Long
Skips specified number of bytes of uncompressed data.
Parameters | |
---|---|
n |
Long: the number of bytes to skip |
Return | |
---|---|
Long |
the actual number of bytes skipped. |
Exceptions | |
---|---|
java.io.IOException |
if an I/O error has occurred |
java.lang.IllegalArgumentException |
if n < 0 |
Protected methods
fill
protected open fun fill(): Unit
Fills input buffer with more data to decompress.
Exceptions | |
---|---|
java.io.IOException |
if an I/O error has occurred |
Properties
closed
protected varclosed: Boolean
Deprecated: This field will be removed from a future version of Android and should not be used. Subclasses that access this field need to be modified to keep track of their own closed state by overriding close().
Indicates whether the #close() method has been called, internal use only.