Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-713

ReaderInputStream documentation regarding available() is incorrect

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.8.0
    • 2.12.0
    • Streams/Writers
    • None

    Description

      The documentation for org.apache.commons.io.input.ReaderInputStream says:

      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.

      However, Reader does actually provide such functionality: Reader.ready().

      But properly implementing available() might be tricky, see related Guava pull request.
      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Marcono1234 Marcono1234
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: