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

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

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

Properties

Link copied to clipboard
Wrapped buffer of type java.nio.DirectByteBuffer.