RFR: JDK-8260694: (fc) Add apiNote to FileChannel.transferFrom to better describe "no bytes available" case [v2]
Hamlin Li
mli at openjdk.java.net
Wed Feb 3 01:11:44 UTC 2021
On Tue, 2 Feb 2021 08:35:31 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Hamlin Li has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR.
>
> src/java.base/share/classes/java/nio/channels/FileChannel.java line 594:
>
>> 592: * This method only returns the number of bytes that were actually
>> 593: * transferred, it will not return -1.
>> 594: *
>
> The transferTo method is file -> target channel and I think it would be confusing to mention -1 here.
> We could add an apiNote to point out that the method returns zero if the given position is greater than the file's current size, and also zero if the target channel is non-blocking and has no bytes free in its output buffer, but I think the javadoc is already clear.
OK, I will remove this @apiNote addition
-------------
PR: https://git.openjdk.java.net/jdk/pull/2329
More information about the nio-dev
mailing list