# OpenOption

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

# OpenOption

```
interface OpenOption
```

|------------------------------------------------------------------------------------------------------|
| [java.nio.file.OpenOption](https://developer.android.com/reference/kotlin/java/nio/file/OpenOption#) |

|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [LinkOption](https://developer.android.com/reference/kotlin/java/nio/file/LinkOption),[StandardOpenOption](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption) |-------------------------------------------------------------------------------------------------------|-----------------------------------------------------------| | [LinkOption](https://developer.android.com/reference/kotlin/java/nio/file/LinkOption)                 | Defines the options as to how symbolic links are handled. | | [StandardOpenOption](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption) | Defines the standard open options.                        | |

|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Indirect Subclasses [LinkOption.NOFOLLOW_LINKS](https://developer.android.com/reference/kotlin/java/nio/file/LinkOption#ENUM_VALUE:NOFOLLOW_LINKS),[StandardOpenOption.APPEND](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:APPEND),[StandardOpenOption.CREATE](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:CREATE),[StandardOpenOption.CREATE_NEW](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:CREATE_NEW),[StandardOpenOption.DELETE_ON_CLOSE](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:DELETE_ON_CLOSE),[StandardOpenOption.DSYNC](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:DSYNC),[StandardOpenOption.READ](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:READ),[StandardOpenOption.SPARSE](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:SPARSE),[StandardOpenOption.SYNC](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:SYNC),[StandardOpenOption.TRUNCATE_EXISTING](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:TRUNCATE_EXISTING),[StandardOpenOption.WRITE](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:WRITE) |------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [LinkOption.NOFOLLOW_LINKS](https://developer.android.com/reference/kotlin/java/nio/file/LinkOption#ENUM_VALUE:NOFOLLOW_LINKS)                       | Do not follow symbolic links.                                                                                                                                                                        | | [StandardOpenOption.APPEND](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:APPEND)                       | If the file is opened for[WRITE](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption)access then bytes will be written to the end of the file rather than the beginning. | | [StandardOpenOption.CREATE](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:CREATE)                       | Create a new file if it does not exist.                                                                                                                                                              | | [StandardOpenOption.CREATE_NEW](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:CREATE_NEW)               | Create a new file, failing if the file already exists.                                                                                                                                               | | [StandardOpenOption.DELETE_ON_CLOSE](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:DELETE_ON_CLOSE)     | Delete on close.                                                                                                                                                                                     | | [StandardOpenOption.DSYNC](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:DSYNC)                         | Requires that every update to the file's content be written synchronously to the underlying storage device.                                                                                          | | [StandardOpenOption.READ](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:READ)                           | Open for read access.                                                                                                                                                                                | | [StandardOpenOption.SPARSE](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:SPARSE)                       | Sparse file.                                                                                                                                                                                         | | [StandardOpenOption.SYNC](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:SYNC)                           | Requires that every update to the file's content or metadata be written synchronously to the underlying storage device.                                                                              | | [StandardOpenOption.TRUNCATE_EXISTING](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:TRUNCATE_EXISTING) | If the file already exists and it is opened for[WRITE](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption)access, then its length is truncated to 0.                    | | [StandardOpenOption.WRITE](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption#ENUM_VALUE:WRITE)                         | Open for write access.                                                                                                                                                                               | |

An object that configures how to open or create a file.

Objects of this type are used by methods such as[newOutputStream](https://developer.android.com/reference/kotlin/java/nio/file/Files#newOutputStream(java.nio.file.Path,%20java.nio.file.OpenOption)), java.nio.file.Files#newByteChannel, java.nio.channels.FileChannel#open, and java.nio.channels.AsynchronousFileChannel#open when opening or creating a file.

The[StandardOpenOption](https://developer.android.com/reference/kotlin/java/nio/file/StandardOpenOption)enumeration type defines the*standard*options.

## Summary