You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Marcono1234 (Jira)" <ji...@apache.org> on 2021/02/03 02:42:00 UTC

[jira] [Updated] (IO-713) ReaderInputStream documentation regarding available() is incorrect

     [ https://issues.apache.org/jira/browse/IO-713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marcono1234 updated IO-713:
---------------------------
    Description: 
The documentation for {{org.apache.commons.io.input.ReaderInputStream}} says:
{quote}
Given the fact that the Reader class doesn't provide any way to predict whether the next read operation will block or not, it is not possible to provide a meaningful implementation of the InputStream.available() method. A call to this method will always return 0.
{quote}

However, {{Reader}} does actually provide such functionality: [{{Reader.ready()}}|https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Reader.html#ready()].

But properly implementing {{available()}} might be tricky, see [related Guava pull request|https://github.com/google/guava/pull/5397].
Therefore it might be easiest to change the documentation, stating that {{available()}} always returns 0 without providing a reason for it.
Or {{available()}} could at least return a result based on {{encoderOut}}.

  was:
The documentation for {{org.apache.commons.io.input.ReaderInputStream}} says:
{quote}
Given the fact that the Reader class doesn't provide any way to predict whether the next read operation will block or not, it is not possible to provide a meaningful implementation of the InputStream.available() method. A call to this method will always return 0.
{quote}

However, {{Reader}} does actually provide such functionality: [{{Reader.ready()}}|https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Reader.html#ready()].

But properly implementing {{available()}} might be tricky, see [related Guava pull request|https://github.com/google/guava/pull/5397].
Therefore it might be easiest to change the documentation, stating that {{available()}} always returns 0 without providing a reason for it.
Or {{available()}} could at least check {{encoderOut}}.


> ReaderInputStream documentation regarding available() is incorrect
> ------------------------------------------------------------------
>
>                 Key: IO-713
>                 URL: https://issues.apache.org/jira/browse/IO-713
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Streams/Writers
>            Reporter: Marcono1234
>            Priority: Minor
>
> The documentation for {{org.apache.commons.io.input.ReaderInputStream}} says:
> {quote}
> Given the fact that the Reader class doesn't provide any way to predict whether the next read operation will block or not, it is not possible to provide a meaningful implementation of the InputStream.available() method. A call to this method will always return 0.
> {quote}
> However, {{Reader}} does actually provide such functionality: [{{Reader.ready()}}|https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Reader.html#ready()].
> But properly implementing {{available()}} might be tricky, see [related Guava pull request|https://github.com/google/guava/pull/5397].
> Therefore it might be easiest to change the documentation, stating that {{available()}} always returns 0 without providing a reason for it.
> Or {{available()}} could at least return a result based on {{encoderOut}}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)