Language

JniEnvironment.IO.NewDirectByteBuffer(IntPtr, Int64) Method

Definition

Wraps existing native memory in a direct Java byte buffer without taking ownership of the memory.

public static Java.Interop.JniObjectReference NewDirectByteBuffer(IntPtr address, long capacity);
static member NewDirectByteBuffer : nativeint * int64 -> Java.Interop.JniObjectReference

Parameters

address
IntPtr

nativeint

The nonzero native memory address. Its owner must keep the memory valid for the Java buffer's entire use.

capacity
Int64

The memory size in bytes, from zero through Int32.MaxValue.

Returns

A local buffer reference that the caller must release, or an invalid reference if JNI returns null without a pending Java exception. A pending Java exception is converted to a managed exception.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to