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

(fc) Clarify FileChannel.transferFrom to better describe "no bytes available" case

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 17
    • core-libs
    • None
    • minimal
    • No compatibility impact.
    • Java API
    • SE

      Summary

      Clarify the specification of the java.nio.channels.FileChannel.transferFrom method to make it clear that it returns 0 when the the source channel is at end-of-stream.

      Problem

      Currently, the API spec for FileChannel.transferFrom is not very clear about the return value, there are several misuse cases where users are not clear about the meaning or value of return value.

      Solution

      Add a clearer message in the API doc of FileChannel.transferFrom.

      Specification

      Add the following to the method description:

      "No bytes are transferred, and zero is returned, if the source has reached end-of-stream."

            mli Hamlin Li
            mli Hamlin Li
            Alan Bateman, Brian Burkhalter
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: