Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Fields](https://developer.android.com/reference/java/util/zip/InflaterOutputStream#lfields) \| [Inherited Fields](https://developer.android.com/reference/java/util/zip/InflaterOutputStream#inhfields) \| [Ctors](https://developer.android.com/reference/java/util/zip/InflaterOutputStream#pubctors) \| [Methods](https://developer.android.com/reference/java/util/zip/InflaterOutputStream#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/util/zip/InflaterOutputStream#inhmethods)

# InflaterOutputStream


`
public


class
InflaterOutputStream
`


`


`

`


`

`

extends https://developer.android.com/reference/java/io/FilterOutputStream


`

`


`

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||||
| ↳ | [java.io.OutputStream](https://developer.android.com/reference/java/io/OutputStream) |||
|   | ↳ | [java.io.FilterOutputStream](https://developer.android.com/reference/java/io/FilterOutputStream) ||
|   |   | ↳ | java.util.zip.InflaterOutputStream |

<br />

*** ** * ** ***

Implements an output stream filter for uncompressing data stored in the
"deflate" compression format.
**See also:**

- `https://developer.android.com/reference/java/util/zip/InflaterInputStream`
- `https://developer.android.com/reference/java/util/zip/DeflaterInputStream`
- `https://developer.android.com/reference/java/util/zip/DeflaterOutputStream`

## Summary

| ### Fields ||
|---|---|
| ` protected final byte[]` | `https://developer.android.com/reference/java/util/zip/InflaterOutputStream#buf` Output buffer for writing uncompressed data. |
| ` protected final https://developer.android.com/reference/java/util/zip/Inflater` | `https://developer.android.com/reference/java/util/zip/InflaterOutputStream#inf` Decompressor for this stream. |

| ### Inherited fields |
|---|
| From class `https://developer.android.com/reference/java/io/FilterOutputStream` |---|---| | ` protected https://developer.android.com/reference/java/io/OutputStream` | `https://developer.android.com/reference/java/io/FilterOutputStream#out` The underlying output stream to be filtered. | |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/java/util/zip/InflaterOutputStream#InflaterOutputStream(java.io.OutputStream)(https://developer.android.com/reference/java/io/OutputStream out) ` Creates a new output stream with a default decompressor and buffer size. |
| ` https://developer.android.com/reference/java/util/zip/InflaterOutputStream#InflaterOutputStream(java.io.OutputStream,%20java.util.zip.Inflater)(https://developer.android.com/reference/java/io/OutputStream out, https://developer.android.com/reference/java/util/zip/Inflater infl) ` Creates a new output stream with the specified decompressor and a default buffer size. |
| ` https://developer.android.com/reference/java/util/zip/InflaterOutputStream#InflaterOutputStream(java.io.OutputStream,%20java.util.zip.Inflater,%20int)(https://developer.android.com/reference/java/io/OutputStream out, https://developer.android.com/reference/java/util/zip/Inflater infl, int bufLen) ` Creates a new output stream with the specified decompressor and buffer size. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/java/util/zip/InflaterOutputStream#close()() ` Writes any remaining uncompressed data to the output stream and closes the underlying output stream. |
| ` void` | ` https://developer.android.com/reference/java/util/zip/InflaterOutputStream#finish()() ` Finishes writing uncompressed data to the output stream without closing the underlying stream. |
| ` void` | ` https://developer.android.com/reference/java/util/zip/InflaterOutputStream#flush()() ` Flushes this output stream, forcing any pending buffered output bytes to be written. |
| ` void` | ` https://developer.android.com/reference/java/util/zip/InflaterOutputStream#write(byte[],%20int,%20int)(byte[] b, int off, int len) ` Writes an array of bytes to the uncompressed output stream. |
| ` void` | ` https://developer.android.com/reference/java/util/zip/InflaterOutputStream#write(int)(int b) ` Writes a byte to the uncompressed output stream. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/io/FilterOutputStream ` |---|---| | ` void` | ` https://developer.android.com/reference/java/io/FilterOutputStream#close()() ` Closes this output stream and releases any system resources associated with the stream. | | ` void` | ` https://developer.android.com/reference/java/io/FilterOutputStream#flush()() ` Flushes this output stream and forces any buffered output bytes to be written out to the stream. | | ` void` | ` https://developer.android.com/reference/java/io/FilterOutputStream#write(byte[])(byte[] b) ` Writes `b.length` bytes to this output stream. | | ` void` | ` https://developer.android.com/reference/java/io/FilterOutputStream#write(byte[],%20int,%20int)(byte[] b, int off, int len) ` Writes `len` bytes from the specified `byte` array starting at offset `off` to this output stream. | | ` void` | ` https://developer.android.com/reference/java/io/FilterOutputStream#write(int)(int b) ` Writes the specified `byte` to this output stream. | ||
| From class ` https://developer.android.com/reference/java/io/OutputStream ` |---|---| | ` void` | ` https://developer.android.com/reference/java/io/OutputStream#close()() ` Closes this output stream and releases any system resources associated with this stream. | | ` void` | ` https://developer.android.com/reference/java/io/OutputStream#flush()() ` Flushes this output stream and forces any buffered output bytes to be written out. | | ` static https://developer.android.com/reference/java/io/OutputStream` | ` https://developer.android.com/reference/java/io/OutputStream#nullOutputStream()() ` Returns a new `OutputStream` which discards all bytes. | | ` void` | ` https://developer.android.com/reference/java/io/OutputStream#write(byte[])(byte[] b) ` Writes `b.length` bytes from the specified byte array to this output stream. | | ` void` | ` https://developer.android.com/reference/java/io/OutputStream#write(byte[],%20int,%20int)(byte[] b, int off, int len) ` Writes `len` bytes from the specified byte array starting at offset `off` to this output stream. | | ` abstract void` | ` https://developer.android.com/reference/java/io/OutputStream#write(int)(int b) ` Writes the specified byte to this output stream. | ||
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||
| From interface ` https://developer.android.com/reference/java/io/Closeable ` |---|---| | ` abstract void` | ` https://developer.android.com/reference/java/io/Closeable#close()() ` Closes this stream and releases any system resources associated with it. | ||
| From interface ` https://developer.android.com/reference/java/io/Flushable ` |---|---| | ` abstract void` | ` https://developer.android.com/reference/java/io/Flushable#flush()() ` Flushes this stream by writing any buffered output to the underlying stream. | ||
| From interface ` https://developer.android.com/reference/java/lang/AutoCloseable ` |---|---| | ` abstract void` | ` https://developer.android.com/reference/java/lang/AutoCloseable#close()() ` Closes this resource, relinquishing any underlying resources. | ||

## Fields

### buf

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
protected final byte[] buf
```

Output buffer for writing uncompressed data.

<br />

### inf

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
protected final Inflater inf
```

Decompressor for this stream.

<br />

## Public constructors

### InflaterOutputStream

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public InflaterOutputStream (OutputStream out)
```

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

<br />

| Parameters ||
|---|---|
| `out` | `OutputStream`: output stream to write the uncompressed data to <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `out` is null |

### InflaterOutputStream

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public InflaterOutputStream (OutputStream out, 
                Inflater infl)
```

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

<br />

| Parameters ||
|---|---|
| `out` | `OutputStream`: output stream to write the uncompressed data to <br /> |
| `infl` | `Inflater`: decompressor ("inflater") for this stream <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `out` or `infl` is null |

### InflaterOutputStream

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public InflaterOutputStream (OutputStream out, 
                Inflater infl, 
                int bufLen)
```

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

<br />

| Parameters ||
|---|---|
| `out` | `OutputStream`: output stream to write the uncompressed data to <br /> |
| `infl` | `Inflater`: decompressor ("inflater") for this stream <br /> |
| `bufLen` | `int`: decompression buffer size <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if `bufLen <= 0` |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `out` or `infl` is null |

## Public methods

### close

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void close ()
```

Writes any remaining uncompressed data to the output stream and closes
the underlying output stream.

<br />

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` | if an I/O error occurs |

### finish

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void finish ()
```

Finishes writing uncompressed data to the output stream without closing
the underlying stream. Use this method when applying multiple filters in
succession to the same output stream.

<br />

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` | if an I/O error occurs or this stream is already closed |

### flush

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void flush ()
```

Flushes this output stream, forcing any pending buffered output bytes to be
written.

<br />

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` | if an I/O error occurs or this stream is already closed |

### write

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void write (byte[] b, 
                int off, 
                int len)
```

Writes an array of bytes to the uncompressed output stream.

<br />

| Parameters ||
|---|---|
| `b` | `byte`: buffer containing compressed data to decompress and write to the output stream <br /> |
| `off` | `int`: starting offset of the compressed data within `b` <br /> |
| `len` | `int`: number of bytes to decompress from `b` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` | if an I/O error occurs or this stream is already closed |
| `https://developer.android.com/reference/java/lang/IndexOutOfBoundsException` | if `off < 0`, or if `len < 0`, or if `len > b.length - off` |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `b` is null |
| `https://developer.android.com/reference/java/util/zip/ZipException` | if a compression (ZIP) format error occurs |

### write

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void write (int b)
```

Writes a byte to the uncompressed output stream.

<br />

| Parameters ||
|---|---|
| `b` | `int`: a single byte of compressed data to decompress and write to the output stream <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` | if an I/O error occurs or this stream is already closed |
| `https://developer.android.com/reference/java/util/zip/ZipException` | if a compression (ZIP) format error occurs |