Summary
During the analysis of JDK-8204930 it turned out that the specification for the mark
method should more align with the Reader
's default behavior.
Solution
Changing the definition for the mark
method to also throw an IOException
if the stream has been closed.
Specification
Update method specification on java.io.Reader
:
/**
* Returns a new {@code Reader} that reads no characters. The returned
* stream is initially open. The stream is closed by calling the
* {@code close()} method. Subsequent calls to {@code close()} have no
* effect.
*
* <p> While the stream is open, the {@code read()}, {@code read(char[])},
* {@code read(char[], int, int)}, {@code read(Charbuffer)}, {@code
* ready()}, {@code skip(long)}, and {@code transferTo()} methods all
* behave as if end of stream has been reached. After the stream has been
* closed, these methods all throw {@code IOException}.
*
* <p> The {@code markSupported()} method returns {@code false}. The
* {@code mark()} and {@code reset()} methods throw an {@code IOException}.
*
* <p> The {@link #lock object} used to synchronize operations on the
* returned {@code Reader} is not specified.
*
* @return a {@code Reader} which reads no characters
*
* @since 11
*/
public static Reader nullReader() {}
- csr of
-
JDK-8204930 Reader:nullReader() spec does not match the behavior
-
- Closed
-
- relates to
-
JDK-8196350 Add null Reader and Writer
-
- Closed
-