Language

JNIEnv.GetDirectBufferCapacity(IntPtr) Method

Definition

Gets the capacity of a direct Java NIO buffer.

public static long GetDirectBufferCapacity(IntPtr buf);
static member GetDirectBufferCapacity : nativeint -> int64

Parameters

buf
IntPtr

nativeint

A live, non-null JNI reference to a Java NIO buffer. On Android 12 and later, it can refer to any Java object.

Returns

The buffer's capacity in elements, or -1 if the virtual machine does not support JNI access to direct buffers. On Android 12 and later, -1 is also returned if the object is not a direct buffer. On Android 5 through 11, a non-direct buffer can return its capacity instead.

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