What's the difference between these standard options?
Alan Bateman
Alan.Bateman at oracle.com
Fri Dec 30 07:30:33 PST 2011
On 28/12/2011 04:15, Scott Palmer wrote:
> I believe the intention is that CREATE will make a new file
> overwriting an existing one of the same name, should such a file
> exists. Whereas CREATE_NEW will not overwrite an existing file.
>
> Scott
>
Scott is right, see also the table in java.nio.file.Files where this is
more clearly explained:
CREATE_NEW
If this option is present then a new file is created, failing if the
file already exists or is a symbolic link. When creating a file 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.
CREATE
If this option is present then an existing file is opened if it exists,
otherwise a new file is created. This option is ignored if the
|CREATE_NEW| option is also present or the file is opened only for reading.
-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-discuss/attachments/20111230/78f5db1c/attachment.html
More information about the nio-discuss
mailing list