Java™ Platform
Standard Ed. 8
compact1, compact2, compact3
java.nio.file
Enum StandardOpenOption
-
-
Enum Constant Summary
Enum Constants
| Enum Constant |
Description |
APPEND |
If the file is opened for WRITE access then bytes will be written
to the end of the file rather than the beginning.
|
CREATE |
Create a new file if it does not exist.
|
CREATE_NEW |
Create a new file, failing if the file already exists.
|
DELETE_ON_CLOSE |
Delete on close.
|
DSYNC |
Requires that every update to the file's content be written
synchronously to the underlying storage device.
|
READ |
Open for read access.
|
SPARSE |
Sparse file.
|
SYNC |
Requires that every update to the file's content or metadata be written
synchronously to the underlying storage device.
|
TRUNCATE_EXISTING |
If the file already exists and it is opened for WRITE
access, then its length is truncated to 0.
|
WRITE |
Open for write access.
|
-
Method Summary
All Methods Static Methods Concrete Methods
| Modifier and Type |
Method |
Description |
static StandardOpenOption |
valueOf(String name) |
Returns the enum constant of this type with the specified name.
|
static StandardOpenOption[] |
values() |
Returns an array containing the constants of this enum type, in
the order they are declared.
|
-
-
Enum Constant Detail
-
CREATE_NEW
public static final StandardOpenOption CREATE_NEW
Create a new file, failing if the file already exists.
The check for the existence of the file and the creation of the file
if it does not exist is atomic with respect to other file system
operations.
-
Method Detail
-
valueOf
public static StandardOpenOption valueOf(String name)
Returns the enum constant of this type with the specified name.
The string must match exactly an identifier used to declare an
enum constant in this type. (Extraneous whitespace characters are
not permitted.)
- Parameters:
name - the name of the enum constant to be returned.
- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null
Java™ Platform
Standard Ed. 8
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.