Proposal for adding O_DIRECT support into JDK 9

Uwe Schindler uschindler at
Sun Aug 28 10:29:51 UTC 2016


IMHO, I'd stay with FOS/FIS/RAF completely out of this business and not change them anymore. Those are legacy APIs!

I'd suggest to add this to StandardOpenOptions ( and use it solely with the Java 7+ NIO.2 Path APIs. No need to change the old-style based APIs. This is easy to implement and add, because you would only add the new Enum constant and then implement it in the default FileSystem(-Provider) for each platform.


Uwe Schindler
uschindler at 
ASF Member, Apache Lucene PMC / Committer
Bremen, Germany

> -----Original Message-----
> From: core-libs-dev [mailto:core-libs-dev-bounces at] On
> Behalf Of Andrew Haley
> Sent: Sunday, August 28, 2016 12:23 PM
> To: Lu, Yingqi < at>; core-libs-dev at
> Cc: Kaczmarek, Eric <eric.kaczmarek at>
> Subject: Re: Proposal for adding O_DIRECT support into JDK 9
> On 26/08/16 23:31, Lu, Yingqi wrote:
> > The proposal adds 4 API methods to java/io/,
> > java/io/ to enable the feature. In addition, it add
> > O_DIRECT with two more modes "ro" (read-only and direct) and "rwo"
> > (read-write and direct) to java/io/
> >
> > public FileInputStream(String name, boolean direct) throws
> FileNotFoundException
> Adding a boolean for O_DIRECT does not scale well.  There are many
> other flags, and if there is some future expansion it would mean
> adding more boolean arguments to the call signature.  It might be
> worth considering a more direct way to make the call to open(2).  I
> appreciate that not every flag passed to open() makes sense, though.
> And there is Windows etc. to think about.  But something like
>   new FileInputStream(filename, File.DIRECT | File.APPEND)
> is much more scalable and involves less argument marshalling.
> Andrew.

More information about the core-libs-dev mailing list