# DeflaterInputStream

public class **DeflaterInputStream** extends [FilterInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterInputStream.html)  
Implements an input stream filter for compressing data in the "deflate"
compression format.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterOutputStream.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/InflaterOutputStream.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/InflaterInputStream.html`

### Field Summary

|---|---|---|
| protected final byte\[\] | [buf](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#buf) | Input buffer for reading compressed data. |
| protected final [Deflater](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/Deflater.html) | [def](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#def) | Compressor for this stream. |

### Inherited Field Summary

From class [java.io.FilterInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterInputStream.html)

|---|---|---|
| protected [InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) | [in](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterInputStream.html#in) | The input stream to be filtered. |

### Public Constructor Summary

|---|---|
|   | [DeflaterInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#DeflaterInputStream(java.io.InputStream))([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) in) Creates a new input stream with a default compressor and buffer size. |
|   | [DeflaterInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#DeflaterInputStream(java.io.InputStream,%20java.util.zip.Deflater))([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) in, [Deflater](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/Deflater.html) defl) Creates a new input stream with the specified compressor and a default buffer size. |
|   | [DeflaterInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#DeflaterInputStream(java.io.InputStream,%20java.util.zip.Deflater,%20int))([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) in, [Deflater](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/Deflater.html) defl, int bufLen) Creates a new input stream with the specified compressor and buffer size. |

### Public Method Summary

|---|---|
| int | [available](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#available())() Returns 0 after EOF has been reached, otherwise always return 1. |
| void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#close())() Closes this input stream and its underlying input stream, discarding any pending uncompressed data. |
| void | [mark](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#mark(int))(int limit) *This operation is not supported*. |
| boolean | [markSupported](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#markSupported())() Always returns `false` because this input stream does not support the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#mark(int)` and `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#reset()` methods. |
| int | [read](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#read())() Reads a single byte of compressed data from the input stream. |
| int | [read](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#read(byte[],%20int,%20int))(byte\[\] b, int off, int len) Reads compressed data into a byte array. |
| void | [reset](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#reset())() *This operation is not supported*. |
| long | [skip](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#skip(long))(long n) Skips over and discards data from the input stream. |

### Inherited Method Summary

From class [java.io.FilterInputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterInputStream.html)

|---|---|
| int | [available](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterInputStream.html#available())() Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. |
| void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterInputStream.html#close())() Closes this input stream and releases any system resources associated with the stream. |
| synchronized void | [mark](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterInputStream.html#mark(int))(int readlimit) Marks the current position in this input stream. |
| boolean | [markSupported](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterInputStream.html#markSupported())() Tests if this input stream supports the `mark` and `reset` methods. |
| int | [read](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterInputStream.html#read())() Reads the next byte of data from this input stream. |
| int | [read](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterInputStream.html#read(byte[],%20int,%20int))(byte\[\] b, int off, int len) Reads up to `len` bytes of data from this input stream into an array of bytes. |
| int | [read](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterInputStream.html#read(byte[]))(byte\[\] b) Reads up to `byte.length` bytes of data from this input stream into an array of bytes. |
| synchronized void | [reset](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterInputStream.html#reset())() Repositions this stream to the position at the time the `mark` method was last called on this input stream. |
| long | [skip](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/FilterInputStream.html#skip(long))(long n) Skips over and discards `n` bytes of data from the input stream. |

From class [java.io.InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html)

|---|---|
| int | [available](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html#available())() Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream. |
| void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html#close())() Closes this input stream and releases any system resources associated with the stream. |
| synchronized void | [mark](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html#mark(int))(int readlimit) Marks the current position in this input stream. |
| boolean | [markSupported](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html#markSupported())() Tests if this input stream supports the `mark` and `reset` methods. |
| abstract int | [read](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html#read())() Reads the next byte of data from the input stream. |
| int | [read](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html#read(byte[],%20int,%20int))(byte\[\] b, int off, int len) Reads up to `len` bytes of data from the input stream into an array of bytes. |
| int | [read](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html#read(byte[]))(byte\[\] b) Reads some number of bytes from the input stream and stores them into the buffer array `b`. |
| synchronized void | [reset](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html#reset())() Repositions this stream to the position at the time the `mark` method was last called on this input stream. |
| long | [skip](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html#skip(long))(long n) Skips over and discards `n` bytes of data from this input stream. |

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

From interface [java.io.Closeable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html#close())() Closes this stream and releases any system resources associated with it. |

From interface [java.lang.AutoCloseable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html#close())() Closes this resource, relinquishing any underlying resources. |

## Fields

#### protected final byte\[\]
**buf**

Input buffer for reading compressed data.

#### protected final [Deflater](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/Deflater.html)
**def**

Compressor for this stream.

## Public Constructors

#### public
**DeflaterInputStream**
([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) in)

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

##### Parameters

| in | input stream to read the uncompressed data to |
|---|---|

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `in` is null |
|---|---|

#### public
**DeflaterInputStream**
([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) in, [Deflater](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/Deflater.html) defl)

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

##### Parameters

| in | input stream to read the uncompressed data to |
| defl | compressor ("deflater") for this stream |
|---|---|

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `in` or `defl` is null |
|---|---|

#### public
**DeflaterInputStream**
([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) in, [Deflater](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/Deflater.html) defl, int bufLen)

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

##### Parameters

| in | input stream to read the uncompressed data to |
| defl | compressor ("deflater") for this stream |
| bufLen | compression buffer size |
|---|---|

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if `bufLen <= 0` |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `in` or `defl` is null |
|---|---|

## Public Methods

#### public 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

##### Returns

- zero after the end of the underlying input stream has been reached, otherwise always returns 1

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error occurs or if this stream is already closed |
|---|---|

#### public void
**close**
()

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

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error occurs |
|---|---|

#### public void
**mark**
(int limit)

*This operation is not supported*.

##### Parameters

| limit | maximum bytes that can be read before invalidating the position marker |
|---|---|

#### public boolean
**markSupported**
()

Always returns `false` because this input stream does not support
the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#mark(int)` and `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/zip/DeflaterInputStream.html#reset()` methods.

##### Returns

- false, always

#### public int
**read**
()

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

##### Returns

- a single byte of compressed data, or -1 if the end of the uncompressed input stream is reached

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error occurs or if this stream is already closed |
|---|---|

#### public int
**read**
(byte\[\] b, int off, int len)

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

##### Parameters

| b | buffer into which the data is read |
| off | starting offset of the data within `b` |
| len | maximum number of compressed bytes to read into `b` |
|---|---|

##### Returns

- the actual number of bytes read, or -1 if the end of the uncompressed input stream is reached

##### Throws

| [IndexOutOfBoundsException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IndexOutOfBoundsException.html) | if `len > b.length - off` |
| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error occurs or if this input stream is already closed |
|---|---|

#### public void
**reset**
()

*This operation is not supported*.

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | always thrown |
|---|---|

#### public long
**skip**
(long n)

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 | number of bytes to be skipped |
|---|---|

##### Returns

- the actual number of bytes skipped

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error occurs or if this stream is already closed |
|---|---|