質問

From this oracle java tutorial:

The OpenOptions Parameter

Several of the methods in this section take an optional OpenOptions parameter. This parameter is optional and the API tells you what the default behavior is for the method when none is specified.

These are the API that they are referring to.

I have not been able to find out what it is the behaviour of a file creation without any StandardOpenOption specified. What are the default StandardOpenOption?

Thanks in advance.

役に立ちましたか?

解決

As the tutorial says, the individual methods which use OpenOptions define their defaults.

Eg. Files.newBufferedWriter defines the following defaults:

If no options are present then this method works as if the CREATE, TRUNCATE_EXISTING, and WRITE options are present. In other words, it opens the file for writing, creating the file if it doesn't exist, or initially truncating an existing regular-file to a size of 0 if it exists.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top