6884800: Path.newInputStream does not usefully implement available()

Martin Buchholz martinrb at google.com
Mon Sep 28 20:22:21 PDT 2009

You could check that available always reports all the remaining bytes
e.g. after

 239             totalRead += bytesRead;

available() should equal fc.size() - totalRead
for maximal usefulness.


On Mon, Sep 28, 2009 at 10:55, Alan Bateman <Alan.Bateman at sun.com> wrote:
> I need a reviewer for this small change.  A long standing issue (4648049) is
> that the InputStream returned by
> Channels.newInputStream(ReadableByteChannel) doesn't usefully implement the
> available method. 6884800 is the case where the channel is to the file, a
> case where available can be easily implemented. The webrev is here:
>  http://cr.openjdk.java.net/~alanb/6884800/webrev.00/
> Thanks,
> Alan.

More information about the nio-dev mailing list