larray icon indicating copy to clipboard operation
larray copied to clipboard

Copying one MappedLByteArray into another MappedLByteArray

Open huntc opened this issue 5 years ago • 1 comments

It doesn't appear as though there's a straightforward way of copying the contents of a buffer produced by LArray.mmap into another buffer produced by LArray.mmap. LArray.mmap returns a MappedLByteArray whereas its copyTo method requires the target to be an LByteArray.

Any advice? Thanks.

huntc avatar Jan 24 '20 19:01 huntc

For reference: my work-around is this:

UnsafeUtil.unsafe.copyMemory(
  sourceBuffer.address,
  targetBuffer.address + targetOffset,
  sourceBuffer.length
)

huntc avatar Jan 24 '20 20:01 huntc