8219014: (bf) Add absolute bulk put methods which accept a source Buffer
Florian Weimer
fweimer at redhat.com
Thu Feb 27 12:58:04 UTC 2020
* Paul Sandoz:
> I’ll let Brian decide on that from the perspective of Buffers, given
> IIRC it does not mention anything about overlapping regions.
>
> However, the incubating memory segment API does:
>
> https://hg.openjdk.java.net/jdk/jdk/file/tip/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAddress.java#l98
>
> We can capture something here first. My preference is an api note.
> Care to propose something?
The existing text:
| Perform bulk copy from source address to target address. More
Probably: Performs a bulk copy
| specifically, the bytes at addresses {@code src} through
| {@code src.addOffset(bytes - 1)} are copied into addresses
| {@code dst} through {@code dst.addOffset(bytes - 1)}.
| If the source and address ranges overlap, then the copying is
Probably: source and target address ranges
| performed as if the bytes at addresses {@code src}
| through {@code src.addOffset(bytes - 1)} were first copied into
| a temporary segment with size {@code bytes}, and then the contents
| of the temporary segment were copied into the bytes at addresses
| {@code dst} through {@code dst.addOffset(bytes - 1)}.
Maybe add this:
| If the source and target address ranges do not overlap, but refer to
| the same underlying backing storage using different addresses, the
| contents of the target address range is unspecified after the copy
| operation.
The intent is to make this a bounded error. You may get random data,
but the operation itself is not erroneous.
Thanks,
Florian
More information about the nio-dev
mailing list