Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/content/res/AssetFileDescriptor.AutoCloseOutputStream#pubctors) \| [Methods](https://developer.android.com/reference/android/content/res/AssetFileDescriptor.AutoCloseOutputStream#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/content/res/AssetFileDescriptor.AutoCloseOutputStream#inhmethods)

# AssetFileDescriptor.AutoCloseOutputStream

*** ** * ** ***

` public static class AssetFileDescriptor.AutoCloseOutputStream `   
` ` ` ` ` ` ` extends https://developer.android.com/reference/android/os/ParcelFileDescriptor.AutoCloseOutputStream ` ` `

|---|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||||
| ↳ | [java.io.OutputStream](https://developer.android.com/reference/java/io/OutputStream) ||||
|   | ↳ | [java.io.FileOutputStream](https://developer.android.com/reference/java/io/FileOutputStream) |||
|   |   | ↳ | [android.os.ParcelFileDescriptor.AutoCloseOutputStream](https://developer.android.com/reference/android/os/ParcelFileDescriptor.AutoCloseOutputStream) ||
|   |   |   | ↳ | android.content.res.AssetFileDescriptor.AutoCloseOutputStream |

<br />

*** ** * ** ***

An OutputStream you can create on a ParcelFileDescriptor, which will take care of calling `https://developer.android.com/reference/android/os/ParcelFileDescriptor#close()` for you when the stream is closed.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/content/res/AssetFileDescriptor.AutoCloseOutputStream#AutoCloseOutputStream(android.content.res.AssetFileDescriptor)(https://developer.android.com/reference/android/content/res/AssetFileDescriptor fd) ` |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/content/res/AssetFileDescriptor.AutoCloseOutputStream#write(byte[])(byte[] buffer) ` Writes `b.length` bytes from the specified byte array to this file output stream. |
| ` void` | ` https://developer.android.com/reference/android/content/res/AssetFileDescriptor.AutoCloseOutputStream#write(byte[],%20int,%20int)(byte[] buffer, int offset, int count) ` Writes `len` bytes from the specified byte array starting at offset `off` to this file output stream. |
| ` void` | ` https://developer.android.com/reference/android/content/res/AssetFileDescriptor.AutoCloseOutputStream#write(int)(int oneByte) ` Writes the specified byte to this file output stream. |

### Inherited methods

From class ` https://developer.android.com/reference/android/os/ParcelFileDescriptor.AutoCloseOutputStream ` ` void` ` https://developer.android.com/reference/android/os/ParcelFileDescriptor.AutoCloseOutputStream#close()() `

Closes this file output stream and releases any system resources associated with this stream.
From class ` https://developer.android.com/reference/java/io/FileOutputStream ` ` void` ` https://developer.android.com/reference/java/io/FileOutputStream#close()() `

Closes this file output stream and releases any system resources associated with this stream.
` void` ` https://developer.android.com/reference/java/io/FileOutputStream#finalize()() `

Cleans up the connection to the file, and ensures that the `close` method of this file output stream is called when there are no more references to this stream.
` https://developer.android.com/reference/java/nio/channels/FileChannel` ` https://developer.android.com/reference/java/io/FileOutputStream#getChannel()() `

Returns the unique `https://developer.android.com/reference/java/nio/channels/FileChannel` object associated with this file output stream.
` final https://developer.android.com/reference/java/io/FileDescriptor` ` https://developer.android.com/reference/java/io/FileOutputStream#getFD()() `

Returns the file descriptor associated with this stream.
` void` ` https://developer.android.com/reference/java/io/FileOutputStream#write(byte[])(byte[] b) `

Writes `b.length` bytes from the specified byte array to this file output stream.
` void` ` https://developer.android.com/reference/java/io/FileOutputStream#write(byte[],%20int,%20int)(byte[] b, int off, int len) `

Writes `len` bytes from the specified byte array starting at offset `off` to this file output stream.
` void` ` https://developer.android.com/reference/java/io/FileOutputStream#write(int)(int b) `

Writes the specified byte to this file 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.

## Public constructors

### AutoCloseOutputStream

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

```
public AutoCloseOutputStream (AssetFileDescriptor fd)
```

<br />

<br />

| Parameters ||
|---|---|
| `fd` | `AssetFileDescriptor` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` |   |

## Public methods

### write

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

```
public void write (byte[] buffer)
```

Writes `b.length` bytes from the specified byte array to this file output stream.

<br />

| Parameters ||
|---|---|
| `buffer` | `byte`: the data. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` |   |

### write

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

```
public void write (byte[] buffer, 
                int offset, 
                int count)
```

Writes `len` bytes from the specified byte array starting at offset `off` to this file output stream.

<br />

| Parameters ||
|---|---|
| `buffer` | `byte`: the data. <br /> |
| `offset` | `int`: the start offset in the data. <br /> |
| `count` | `int`: the number of bytes to write. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` |   |

### write

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

```
public void write (int oneByte)
```

Writes the specified byte to this file output stream. Implements the `write` method of `OutputStream`.

<br />

| Parameters ||
|---|---|
| `oneByte` | `int`: the byte to be written. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` |   |