JDK-8247918 : Clarify Reader.skip behavior for end of stream
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 14.0.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2020-06-06
  • Updated: 2021-03-02
  • Resolved: 2021-02-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17 b11Fixed
Related Reports
CSR :  
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
The documentation for java.io.Reader.skip current says
>Skips characters. This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached.

However, it is not directly clear what the behavior will be in case the end of stream is reached:
- Is 0 returned because no character has been skipped?
- Is -1 returned similar to read()?
- Is an EOFException thrown?

It would be good to explicitly specify the behavior (which seems to be returning 0).



Comments
Changeset: 7ffa1481 Author: Brian Burkhalter <bpb@openjdk.org> Date: 2021-02-19 17:21:11 +0000 URL: https://git.openjdk.java.net/jdk/commit/7ffa1481
19-02-2021

This is an enhacement request from submitter https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/io/Reader.html#skip(long) Moving it to Dev team for evaluation.
19-06-2020