AsynchronousFileChannel Open options

Alan Bateman Alan.Bateman at Sun.COM
Mon May 5 08:57:58 PDT 2008

Umashankar wrote:
> Hi Alan,
>  Creating an asynchronous file channel without passing any of the Open 
> options (READ,WRITE) does not open an existing file for reading.
>  As per the AsynchronousFileChannel#open() specification, it should 
> have opened the file for reading in this case.  Here is what the spec 
> says :
> "The READ and WRITE options determines if the file should be opened 
> for reading and/or writing. If neither option is contained in the 
> array then an existing file is opened for reading."
>  I checked the behavior of a SeekableByteChannel  in this scenario, it 
> seems to be working fine.
> Thanks,
> Umashankar
Umashankar - this is Windows only - right? If so, you are correct, and 
it should default to reading for this case. I just checked the unit 
tests I created for AsynchonrousFileChannel and they don't exercise the 
open method with all combinations of options so there may be a few other 
issues lurking here. The checking and mapping of options needs to be 
cleaned up anyway so assume this will be resolved for the next drop. 
I'll send you mail next week on this as I don't think much will happy 
this week due to JavaOne.


More information about the nio-dev mailing list