Query : AsynchronousFileChannel Open options

Alan Bateman Alan.Bateman at Sun.COM
Mon May 5 09:12:32 PDT 2008


Umashankar wrote:
> Hi Alan,
> I noticed the following two behaviors of 
> AsynchronousFileChannel.open() method that seem to be violating the spec:
>
> 1. Invoking AsynchronousFileChannel.open() method specifying path to a 
> file that does not exist and CREAT_NEW or CREATE as Open Options 
> throws    NoSuchFileException. As per the spec, if CREATE_NEW or 
> CREATE option is present then a new file should be created if it does 
> not exist.
>
> 2.Invoking AsynchronousFileChannel.open() method specifying path to a 
> file that exists and CREAT_NEW as Open Option does not throw 
> FileAlreadyExistsException.
>
> Please clarify.
What other options are included? I ask because the CREATE and CREATE_NEW 
options are specified to be ignored if the file is opened only for 
reading. I quickly checked CREATE + WRITE, and CREATE_NEW + WRITE and 
they are behaving as expected.

-Alan.



More information about the nio-dev mailing list