DataRef

open class DataRef

This class wraps a DirectByteBuffer, which allows memory sharing between native and the JVM. It's safe to access the wrapped Bytebuffer even if the buffer itself outlives its DataRef wrapper.

Constructors

DataRef
Link copied to clipboard
open fun DataRef(@NonNull buffer: ByteBuffer)
Create a wrapper for the DirectByteBuffer so that native code can access the underlying memory region allocated by the DirectByteBuffer.

Functions

allocateNative
Link copied to clipboard
open fun allocateNative(size: Int): DataRef
Create a ByteBuffer directly on native memory.

Properties

buffer
Link copied to clipboard
private open val buffer: ByteBuffer
Wrapped buffer of type java.nio.DirectByteBuffer.