Added in API level 1

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

Creates a new input stream with a default decompressor and buffer size.

Creates a new input stream with the specified decompressor and a default buffer size.

Creates a new input stream with the specified decompressor and buffer size.

Public methods
open Int

Returns 0 after EOF has been reached, otherwise always return 1.

open Unit

Closes this input stream and releases any system resources associated with the stream.

open Unit
mark(readlimit: Int)

Marks the current position in this input stream.

open Boolean

Tests if this input stream supports the mark and reset methods.

open Int

Reads a byte of uncompressed data.

open Int
read(b: ByteArray!, off: Int, len: Int)

Reads uncompressed data into an array of bytes.

open Unit

Repositions this stream to the position at the time the mark method was last called on this input stream.

open Long
skip(n: Long)

Skips specified number of bytes of uncompressed data.

Protected methods
open Unit

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

Added in API level 1
InflaterInputStream(in: InputStream!)

Creates a new input stream with a default decompressor and buffer size.

Parameters
in InputStream!: the input stream

InflaterInputStream

Added in API level 1
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

Added in API level 1
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

Public methods

available

Added in API level 1
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

Added in API level 1
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

Added in API level 1
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.

markSupported

Added in API level 1
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

Added in API level 1
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

Added in API level 1
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

Added in API level 1
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

Added in API level 1
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

Added in API level 1
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

buf

Added in API level 1
protected var buf: ByteArray!

Input buffer for decompression.

closed

Added in API level 24
Deprecated in API level 29
protected var closed: 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.

inf

Added in API level 1
protected var inf: Inflater!

Decompressor for this stream.

len

Added in API level 1
protected var len: Int

Length of input buffer.