Query : AsynchronousFileChannel Open options

Umashankar Umashankar.Ningaiah at Sun.COM
Mon May 5 10:11:34 PDT 2008


Alan Bateman wrote:
> 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.
Alan,
  I am specifying either CREATE_NEW or CREATE option only. No other 
options included.
Thanks,
Umashankar



More information about the nio-dev mailing list