Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8248383

Clarify java.io.Reader.read(char[], ...) behavior for full array

XMLWordPrintable

    • b03
    • x86_64
    • windows_10

      A DESCRIPTION OF THE PROBLEM :
      The documentation for the following java.io.Reader methods does not explain how the methods behave if an array of length 0, respectively length 0 is provided:
      - read(char[])
      - read(char[], int, int)

      It is not clear whether
      - 0 should be returned
      - -1 should be returned if at end of stream
      - An IOException should be thrown if reader is closed

      Compare this to the documentation of java.io.InputStream where this is clearly specified.
      It appears most of the JDK classes check if the reader is closed and afterwards return 0 in these cases.

      Related to JDK-8222329


            bpb Brian Burkhalter
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: