JDK-8011136 : FileInputStream.available and skip inconsistencies
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 8
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2013-04-01
  • Updated: 2017-05-17
  • Resolved: 2013-05-17
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 8
8 b93Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
This bug is created to track inconsistencies in java.io.FileInputStream.

The available() method returns a negative value when the file position is beyond the current file size. This is unspecified behavior that has the potential to break applications that expect available to return a value of 0 or greater. This appears to be long standing behavior. Note that Files.newInputStream returns an InputStream that returns 0 for the same case.

The skip(long) method allows a negative value to be provided. This conflicts with both the InputStream and FIleInputStream specification. Again, this seems to be long standing behavior and may require changes to the specification of both classes.