Request/discussion: BufferedReader reading using async API while providing sync API
pavel.rappo at oracle.com
Fri Oct 21 17:22:55 UTC 2016
Off the top of my head, I would say it's not possible to change the design of an
_extensible_ type that has been out there for 20 or so years. All these I/O
streams from java.io were designed for simple synchronous use case.
It's not that their design is flawed in some way, it's that they doesn't seem to
suit your needs. Have you considered using java.nio.channels.AsynchronousFileChannel
in your applications?
> On 21 Oct 2016, at 17:08, Brunoais <brunoaiss at gmail.com> wrote:
> Any feedback on this? I'm really interested in implementing such BufferedReader/BufferedStreamReader to allow speeding up my applications without having to think in an asynchronous way or multi-threading while programming with it.
> That's why I'm asking this here.
> On 13/10/2016 14:45, Brunoais wrote:
>> I looked at BufferedReader source code for java 9 long with the source code of the channels/streams used. I noticed that, like in java 7, BufferedReader does not use an Async API to load data from files, instead, the data loading is all done synchronously even when the OS allows requesting a file to be read and getting a warning later when the file is effectively read.
>> Why Is BufferedReader not async while providing a sync API?
More information about the core-libs-dev