StandardOpenOption Enums Flashcards

1
Q

How are StandardOpenOption Enums used?

A
With input/outputStream Readers.
OutputStream out = Files.newOutputStream(tmp, StandardOpenOption.DELETE_ON_CLOSE);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

If the file is opened for WRITE access then bytes will be written to the end of the file rather than the beginning is controlled using which Enum?

A

APPEND

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Create a new file if it does not exist?

A

CREATE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Create a new file, failing if the file already exists.

A

CREATE_NEW

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Delete on close.

A

DELETE_ON_CLOSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Requires that every update to the file’s content be written synchronously to the underlying storage device.

A

DSYNC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Open for read access.

A

READ

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When used with the CREATE_NEW option then this option provides a hint that the new file will be sparse. The option is ignored when the file system does not support the creation of sparse files.

A

SPARSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Requires that every update to the file’s content or metadata be written synchronously to the underlying storage device.

A

SYNC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

If the file already exists and it is opened for WRITE access, then its length is truncated to 0.

A

TRUNCATE_EXISTING

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Open for write access.

A

WRITE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Write

A

Open for write access.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

TRUNCATE_EXISTING

A

If the file already exists and it is opened for WRITE access, then its length is truncated to 0.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

SYNC

A

Requires that every update to the file’s content or metadata be written synchronously to the underlying storage device.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

SPARSE

A

When used with the CREATE_NEW option then this option provides a hint that the new file will be sparse. The option is ignored when the file system does not support the creation of sparse files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

READ

A

Open for read access.

17
Q

DSYNC

A

Requires that every update to the file’s content be written synchronously to the underlying storage device.

18
Q

DELETE_ON_CLOSE

A

Delete on close.

19
Q

CREATE_NEW

A

Create a new file, failing if the file already exists.

20
Q

CREATE

A

Create a new file if it does not exist.

21
Q

APPEND

A

If the file is opened for WRITE access then bytes will be written to the end of the file rather than the beginning.