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

# ParcelFileDescriptor.AutoCloseOutputStream

*** ** * ** ***


`
public
static


class
ParcelFileDescriptor.AutoCloseOutputStream
`


`


`

`


`

`

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


`

`


`

|---|---|---|---|
| [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 |

|---|
| Known direct subclasses [AssetFileDescriptor.AutoCloseOutputStream](https://developer.android.com/reference/android/content/res/AssetFileDescriptor.AutoCloseOutputStream) |---|---| | [AssetFileDescriptor.AutoCloseOutputStream](https://developer.android.com/reference/android/content/res/AssetFileDescriptor.AutoCloseOutputStream) | 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. | |

<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/os/ParcelFileDescriptor.AutoCloseOutputStream#AutoCloseOutputStream(android.os.ParcelFileDescriptor)(https://developer.android.com/reference/android/os/ParcelFileDescriptor pfd) ` |

| ### Public methods ||
|---|---|
| ` 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. |

| ### Inherited methods |
|---|---|
| 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 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public AutoCloseOutputStream (ParcelFileDescriptor pfd)
```

<br />

<br />

| Parameters ||
|---|---|
| `pfd` | `ParcelFileDescriptor` <br /> |

## Public methods

### close

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

```
public void close ()
```

Closes this file output stream and releases any system resources
associated with this stream. This file output stream may no longer
be used for writing bytes.

If this stream has an associated channel then the channel is closed
as well.

<br />

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