Details
Description
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 toJDK-8222329
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
Attachments
Issue Links
- csr for
-
JDK-8258067 Clarify java.io.Reader.read(char[], ...) behavior for full array
- Closed
- relates to
-
JDK-8258444 Clean up specifications of java.io.Reader.read(char[],int,int) in subclass overrides
- Resolved