8219014: (bf) Add absolute bulk put methods which accept a source Buffer

Brian Burkhalter brian.burkhalter at oracle.com
Thu Feb 6 20:30:37 UTC 2020


> On Feb 6, 2020, at 12:09 PM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> 
> To me the spec is quite straightforward, it should behave as is the relative bulk method adjusting and reverting the positional state.

That’s the behavior, except that in its present form the proposed method allows the source and target buffers to be the same.

>>> Since buffers are not thread safe the absolute bulk implementation could save the positional state use the relative method and restore the positional state?
>> 
>> Without any sort of locking I wonder if that would not be a bit dangerous.
> 
> Why? Buffers are anyway stateful and not thread safe.  Composing the implementation from public only methods should ensure the integrity of the buffers is maintained if operated on concurrently (since one can anyway code that up externally).

That’s true. The implementation proposed here follows more from that used in ByteBuffer.put(int,byte[],int,int).

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20200206/4db32562/attachment.htm>


More information about the nio-dev mailing list