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

FileInputStream.available and skip inconsistencies

XMLWordPrintable

    • b93
    • Verified


      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.

            dxu Dan Xu (Inactive)
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: