8219014: (bf) Add absolute bulk put methods which accept a source Buffer
Daniel Fuchs
daniel.fuchs at oracle.com
Fri Feb 7 17:14:51 UTC 2020
Hi Brian,
On 07/02/2020 17:02, Brian Burkhalter wrote:
> If it is a view then it should be either a read-only buffer of the same
> type as the target, or a buffer of a different type in which case it
> would cause a compilation error. So I don’t know about that this
> verbiage change would be called for, unless I am missing something.
>
Well - I am not sure I understand what said verbiage means then.
Assuming:
byte[] bytes = ....;
var b1 = ByteBuffer.wrap(bytes);
var b2 = ByteBuffer.wrap(bytes);
var b3 = b1.asReadOnly();
b2.put(1, b1, 0, len-1);
b1.put(1, b3, 0, len-1);
wouldn't any of these put you in the exact same troublesome
situation as:
b2.put(1, b2, 0, len-1);
cheers,
-- daniel
More information about the nio-dev
mailing list