RFR: 8222329: Readable read(CharBuffer) does not specify that 0 is returned when there is no remaining space in buffer [v4]

Alan Bateman alanb at openjdk.org
Fri Jun 23 16:53:04 UTC 2023


On Fri, 23 Jun 2023 15:38:52 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> src/java.base/share/classes/java/nio/X-Buffer.java.template line 484:
>> 
>>> 482:      * @throws ReadOnlyBufferException if target is a read only buffer,
>>> 483:      *         even if it is empty
>>> 484:      * @since 1.5
>> 
>> It might be clearer if this method linked to the length method. That way it could be specified to return 0 when the length of the target buffer is 0.
>> 
>> For the @throws of ROBE, probably need to avoid the word "empty", only because this method writes to the target buffer, it doesn't read from the target buffer.
>
> Addressed in 94505a45ce099faf3e31a07b8500ac456345a3b1; CSR not yet updated.

I checked the update but it now has "no source remaining or its length is zero". In CB, length == remaining so I think you just want one in the description.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14616#discussion_r1240038493


More information about the nio-dev mailing list