[
https://issues.apache.org/jira/browse/IO-713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary D. Gregory resolved IO-713.
--------------------------------
Fix Version/s: 2.12.0
Resolution: Fixed
[~Marcono1234]
Please verify git master and close.
> 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
> Affects Versions: 2.8.0
> Reporter: Marcono1234
> Priority: Minor
> Fix For: 2.12.0
>
>
> 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.20.1#820001)