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 11:54:00 UTC 2021
On Wed, 3 Feb 2021 08:07:28 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Hi Brian,
>> At the beginning, I don't think this patch is necessary, because I think if I read really carefully, then I can avoid the misuse.
>> But the truth is there are several misuse cases, not just in my company, several are in opensource projects. So, I think it's worth to emphasize it even if it's a little redudant.
>> How do you think about it?
>
> The transferXXX methods return the number of bytes that were transferred to or from the file so there should be no expectation that -1 is returned. My preference would be to just clarify the transferFrom javadoc to make it clear that zero is returned when the source has reached end-of-stream.
OK, I have removed the apiNote and only refine the javadoc as Brian suggested.
Would you mind to take another look? Thanks
-------------
PR: https://git.openjdk.java.net/jdk/pull/2329
More information about the nio-dev
mailing list