Added in API level 9

DeflaterInputStream

open class DeflaterInputStream : FilterInputStream
kotlin.Any
   ↳ java.io.InputStream
   ↳ java.io.FilterInputStream
   ↳ java.util.zip.DeflaterInputStream

Implements an input stream filter for compressing data in the "deflate" compression format.

Summary

Public constructors

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

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

DeflaterInputStream(in: InputStream!, defl: Deflater!, bufLen: Int)

Creates a new input stream with the specified compressor 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 its underlying input stream, discarding any pending uncompressed data.

open Unit
mark(limit: Int)

This operation is not supported.

open Boolean

Always returns false because this input stream does not support the #mark and #reset methods.

open Int

Reads a single byte of compressed data from the input stream.

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

Reads compressed data into a byte array.

open Unit

This operation is not supported.

open Long
skip(n: Long)

Skips over and discards data from the input stream.

Inherited functions
Properties
ByteArray!

Input buffer for reading compressed data.

Deflater!

Compressor for this stream.

Inherited properties

Public constructors

DeflaterInputStream

Added in API level 9
DeflaterInputStream(in: InputStream!)

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

Parameters
in InputStream!: input stream to read the uncompressed data to
Exceptions
java.lang.NullPointerException if in is null

DeflaterInputStream

Added in API level 9
DeflaterInputStream(
    in: InputStream!,
    defl: Deflater!)

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

Parameters
in InputStream!: input stream to read the uncompressed data to
defl Deflater!: compressor ("deflater") for this stream
Exceptions
java.lang.NullPointerException if in or defl is null

DeflaterInputStream

Added in API level 9
DeflaterInputStream(
    in: InputStream!,
    defl: Deflater!,
    bufLen: Int)

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

Parameters
in InputStream!: input stream to read the uncompressed data to
defl Deflater!: compressor ("deflater") for this stream
bufLen Int: compression buffer size
Exceptions
java.lang.IllegalArgumentException if bufLen <= 0
java.lang.NullPointerException if in or defl is null

Public methods

available

Added in API level 9
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 zero after the end of the underlying input stream has been reached, otherwise always returns 1
Exceptions
java.io.IOException if an I/O error occurs or if this stream is already closed

close

Added in API level 9
open fun close(): Unit

Closes this input stream and its underlying input stream, discarding any pending uncompressed data.

Exceptions
java.lang.Exception if this resource cannot be closed
java.io.IOException if an I/O error occurs

mark

Added in API level 9
open fun mark(limit: Int): Unit

This operation is not supported.

Parameters
readlimit the maximum limit of bytes that can be read before the mark position becomes invalid.
limit Int: maximum bytes that can be read before invalidating the position marker

markSupported

Added in API level 9
open fun markSupported(): Boolean

Always returns false because this input stream does not support the #mark and #reset methods.

Return
Boolean false, always

read

Added in API level 9
open fun read(): Int

Reads a single byte of compressed data from the input stream. This method will block until some input can be read and compressed.

Return
Int a single byte of compressed data, or -1 if the end of the uncompressed input stream is reached
Exceptions
java.io.IOException if an I/O error occurs or if this stream is already closed

read

Added in API level 9
open fun read(
    b: ByteArray!,
    off: Int,
    len: Int
): Int

Reads compressed data into a byte array. This method will block until some input can be read and compressed.

Parameters
b ByteArray!: buffer into which the data is read
off Int: starting offset of the data within b
len Int: maximum number of compressed bytes to read into b
Return
Int the actual number of bytes read, or -1 if the end of the uncompressed input stream is reached
Exceptions
java.io.IOException if an I/O error occurs or if this input stream is already closed
java.lang.NullPointerException If b is null.
java.lang.IndexOutOfBoundsException if len > b.length - off

reset

Added in API level 9
open fun reset(): Unit

This operation is not supported.

Exceptions
java.io.IOException always thrown

skip

Added in API level 9
open fun skip(n: Long): Long

Skips over and discards data from the input stream. This method may block until the specified number of bytes are read and skipped. Note: While n is given as a long, the maximum number of bytes which can be skipped is Integer.MAX_VALUE.

Parameters
n Long: number of bytes to be skipped
Return
Long the actual number of bytes skipped
Exceptions
java.io.IOException if an I/O error occurs or if this stream is already closed

Properties

buf

Added in API level 9
protected val buf: ByteArray!

Input buffer for reading compressed data.

def

Added in API level 9
protected val def: Deflater!

Compressor for this stream.