public class JNINativeInterface
extends java.lang.Object
The JNI is a native programming interface. It allows Java code that runs inside a Java Virtual Machine (VM) to interoperate with applications and libraries written in other programming languages, such as C, C++, and assembly.
The most important benefit of the JNI is that it imposes no restrictions on the implementation of the underlying Java VM. Therefore, Java VM vendors can add support for the JNI without affecting other parts of the VM. Programmers can write one version of a native application or library and expect it to work with all Java VMs supporting the JNI.
LWJGL: Only functions that can reasonably be called from Java are exposed.
| Modifier and Type | Field and Description |
|---|---|
static int |
JNI_ABORT
Used in
ReleaseScalarArrayElements. |
static int |
JNI_COMMIT
Used in
ReleaseScalarArrayElements. |
static int |
JNI_EDETACHED
Possible return values for JNI functions.
|
static int |
JNI_EEXIST
Possible return values for JNI functions.
|
static int |
JNI_EINVAL
Possible return values for JNI functions.
|
static int |
JNI_ENOMEM
Possible return values for JNI functions.
|
static int |
JNI_ERR
Possible return values for JNI functions.
|
static int |
JNI_EVERSION
Possible return values for JNI functions.
|
static int |
JNI_FALSE
jboolean constants.
|
static int |
JNI_OK
Possible return values for JNI functions.
|
static int |
JNI_TRUE
jboolean constants.
|
static int |
JNI_VERSION_1_1
JNI versions.
|
static int |
JNI_VERSION_1_2
JNI versions.
|
static int |
JNI_VERSION_1_4
JNI versions.
|
static int |
JNI_VERSION_1_6
JNI versions.
|
static int |
JNI_VERSION_1_8
JNI versions.
|
static int |
JNI_VERSION_10
JNI versions.
|
static int |
JNI_VERSION_9
JNI versions.
|
static int |
JNIGlobalRefType
jobjectRefType: Return values from GetObjectRefType(java.lang.Object). |
static int |
JNIInvalidRefType
jobjectRefType: Return values from GetObjectRefType(java.lang.Object). |
static int |
JNILocalRefType
jobjectRefType: Return values from GetObjectRefType(java.lang.Object). |
static int |
JNIWeakGlobalRefType
jobjectRefType: Return values from GetObjectRefType(java.lang.Object). |
| Modifier and Type | Method and Description |
|---|---|
static void |
DeleteGlobalRef(long globalRef)
Deletes the global reference pointed to by
globalRef. |
static void |
DeleteWeakGlobalRef(long weakGlobalRef)
Delete the VM resources needed for the given weak global reference.
|
static long |
FromReflectedField(java.lang.reflect.Field field)
Converts a
Field to a field ID. |
static long |
FromReflectedMethod(java.lang.reflect.Method method)
Converts a
Method or Constructor object to a method ID. |
static java.nio.ByteBuffer |
GetBooleanArrayElements(byte[] array,
java.nio.ByteBuffer isCopy)
Returns the body of the primitive array.
|
static void |
GetBooleanArrayRegion(byte[] array,
int start,
java.nio.ByteBuffer buf)
Copies a region of a primitive array into a buffer.
|
static java.nio.ByteBuffer |
GetByteArrayElements(byte[] array,
java.nio.ByteBuffer isCopy)
Returns the body of the primitive array.
|
static void |
GetByteArrayRegion(byte[] array,
int start,
java.nio.ByteBuffer buf)
Copies a region of a primitive array into a buffer.
|
static java.nio.ShortBuffer |
GetCharArrayElements(char[] array,
java.nio.ByteBuffer isCopy)
Returns the body of the primitive array.
|
static void |
GetCharArrayRegion(char[] array,
int start,
java.nio.ShortBuffer buf)
Copies a region of a primitive array into a buffer.
|
static long |
GetDirectBufferAddress(java.nio.Buffer buf)
Fetches and returns the starting address of the memory region referenced by the given direct
java.nio.Buffer. |
static java.nio.DoubleBuffer |
GetDoubleArrayElements(double[] array,
java.nio.ByteBuffer isCopy)
Returns the body of the primitive array.
|
static void |
GetDoubleArrayRegion(double[] array,
int start,
java.nio.DoubleBuffer buf)
Copies a region of a primitive array into a buffer.
|
static java.nio.FloatBuffer |
GetFloatArrayElements(float[] array,
java.nio.ByteBuffer isCopy)
Returns the body of the primitive array.
|
static void |
GetFloatArrayRegion(float[] array,
int start,
java.nio.FloatBuffer buf)
Copies a region of a primitive array into a buffer.
|
static java.nio.IntBuffer |
GetIntArrayElements(int[] array,
java.nio.ByteBuffer isCopy)
Returns the body of the primitive array.
|
static void |
GetIntArrayRegion(int[] array,
int start,
java.nio.IntBuffer buf)
Copies a region of a primitive array into a buffer.
|
static int |
GetJavaVM(org.lwjgl.PointerBuffer vm)
Returns the Java VM interface (used in the Invocation API) associated with the current thread.
|
static java.nio.LongBuffer |
GetLongArrayElements(long[] array,
java.nio.ByteBuffer isCopy)
Returns the body of the primitive array.
|
static void |
GetLongArrayRegion(long[] array,
int start,
java.nio.LongBuffer buf)
Copies a region of a primitive array into a buffer.
|
static int |
GetObjectRefType(java.lang.Object obj)
Returns the type of the object referred to by the
obj argument. |
static java.nio.ShortBuffer |
GetShortArrayElements(short[] array,
java.nio.ByteBuffer isCopy)
Returns the body of the primitive array.
|
static void |
GetShortArrayRegion(short[] array,
int start,
java.nio.ShortBuffer buf)
Copies a region of a primitive array into a buffer.
|
static void |
GetStringRegion(java.lang.String str,
int start,
java.nio.ByteBuffer buf)
Copies
len number of Unicode characters beginning at offset start to the given buffer buf. |
static void |
GetStringUTFRegion(java.lang.String str,
int start,
int len,
java.nio.ByteBuffer buf)
Translates
len number of Unicode characters beginning at offset start into modified UTF-8 encoding and place the result in the given buffer
buf. |
static int |
GetVersion()
Returns the version of the native method interface.
|
static void |
nDeleteGlobalRef(long globalRef)
Unsafe version of:
DeleteGlobalRef(long) |
static void |
nDeleteWeakGlobalRef(long weakGlobalRef)
Unsafe version of:
DeleteWeakGlobalRef(long) |
static java.nio.ByteBuffer |
NewDirectByteBuffer(long address,
long capacity)
Allocates and returns a direct
java.nio.ByteBuffer referring to the block of memory starting at the memory address address and extending
capacity bytes. |
static long |
NewGlobalRef(java.lang.Object obj)
Creates a new global reference to the object referred to by the
obj argument. |
static long |
NewWeakGlobalRef(java.lang.Object obj)
Creates a new weak global reference.
|
static long |
nGetBooleanArrayElements(byte[] array,
long isCopy)
Unsafe version of:
GetBooleanArrayElements(byte[], java.nio.ByteBuffer) |
static void |
nGetBooleanArrayRegion(byte[] array,
int start,
int len,
long buf)
Unsafe version of:
GetBooleanArrayRegion(byte[], int, java.nio.ByteBuffer) |
static long |
nGetByteArrayElements(byte[] array,
long isCopy)
Unsafe version of:
GetByteArrayElements(byte[], java.nio.ByteBuffer) |
static void |
nGetByteArrayRegion(byte[] array,
int start,
int len,
long buf)
Unsafe version of:
GetByteArrayRegion(byte[], int, java.nio.ByteBuffer) |
static long |
nGetCharArrayElements(char[] array,
long isCopy)
Unsafe version of:
GetCharArrayElements(char[], java.nio.ByteBuffer) |
static void |
nGetCharArrayRegion(char[] array,
int start,
int len,
long buf)
Unsafe version of:
GetCharArrayRegion(char[], int, java.nio.ShortBuffer) |
static long |
nGetDoubleArrayElements(double[] array,
long isCopy)
Unsafe version of:
GetDoubleArrayElements(double[], java.nio.ByteBuffer) |
static void |
nGetDoubleArrayRegion(double[] array,
int start,
int len,
long buf)
Unsafe version of:
GetDoubleArrayRegion(double[], int, java.nio.DoubleBuffer) |
static long |
nGetFloatArrayElements(float[] array,
long isCopy)
Unsafe version of:
GetFloatArrayElements(float[], java.nio.ByteBuffer) |
static void |
nGetFloatArrayRegion(float[] array,
int start,
int len,
long buf)
Unsafe version of:
GetFloatArrayRegion(float[], int, java.nio.FloatBuffer) |
static long |
nGetIntArrayElements(int[] array,
long isCopy)
Unsafe version of:
GetIntArrayElements(int[], java.nio.ByteBuffer) |
static void |
nGetIntArrayRegion(int[] array,
int start,
int len,
long buf)
Unsafe version of:
GetIntArrayRegion(int[], int, java.nio.IntBuffer) |
static int |
nGetJavaVM(long vm)
Unsafe version of:
GetJavaVM(org.lwjgl.PointerBuffer) |
static long |
nGetLongArrayElements(long[] array,
long isCopy)
Unsafe version of:
GetLongArrayElements(long[], java.nio.ByteBuffer) |
static void |
nGetLongArrayRegion(long[] array,
int start,
int len,
long buf)
Unsafe version of:
GetLongArrayRegion(long[], int, java.nio.LongBuffer) |
static long |
nGetShortArrayElements(short[] array,
long isCopy)
Unsafe version of:
GetShortArrayElements(short[], java.nio.ByteBuffer) |
static void |
nGetShortArrayRegion(short[] array,
int start,
int len,
long buf)
Unsafe version of:
GetShortArrayRegion(short[], int, java.nio.ShortBuffer) |
static void |
nGetStringRegion(java.lang.String str,
int start,
int len,
long buf)
Unsafe version of:
GetStringRegion(java.lang.String, int, java.nio.ByteBuffer) |
static void |
nGetStringUTFRegion(java.lang.String str,
int start,
int len,
long buf)
Unsafe version of:
GetStringUTFRegion(java.lang.String, int, int, java.nio.ByteBuffer) |
static java.nio.ByteBuffer |
nNewDirectByteBuffer(long address,
long capacity)
Unsafe version of:
NewDirectByteBuffer(long, long) |
static int |
nRegisterNatives(java.lang.Class<?> targetClass,
long methods,
int nMethods)
|
static void |
nReleaseBooleanArrayElements(byte[] array,
long elems,
int mode)
Unsafe version of:
ReleaseBooleanArrayElements(byte[], java.nio.ByteBuffer, int) |
static void |
nReleaseByteArrayElements(byte[] array,
long elems,
int mode)
Unsafe version of:
ReleaseByteArrayElements(byte[], java.nio.ByteBuffer, int) |
static void |
nReleaseCharArrayElements(char[] array,
long elems,
int mode)
Unsafe version of:
ReleaseCharArrayElements(char[], java.nio.ShortBuffer, int) |
static void |
nReleaseDoubleArrayElements(double[] array,
long elems,
int mode)
Unsafe version of:
ReleaseDoubleArrayElements(double[], java.nio.DoubleBuffer, int) |
static void |
nReleaseFloatArrayElements(float[] array,
long elems,
int mode)
Unsafe version of:
ReleaseFloatArrayElements(float[], java.nio.FloatBuffer, int) |
static void |
nReleaseIntArrayElements(int[] array,
long elems,
int mode)
Unsafe version of:
ReleaseIntArrayElements(int[], java.nio.IntBuffer, int) |
static void |
nReleaseLongArrayElements(long[] array,
long elems,
int mode)
Unsafe version of:
ReleaseLongArrayElements(long[], java.nio.LongBuffer, int) |
static void |
nReleaseShortArrayElements(short[] array,
long elems,
int mode)
Unsafe version of:
ReleaseShortArrayElements(short[], java.nio.ShortBuffer, int) |
static void |
nSetBooleanArrayRegion(byte[] array,
int start,
int len,
long buf)
Unsafe version of:
SetBooleanArrayRegion(byte[], int, java.nio.ByteBuffer) |
static void |
nSetByteArrayRegion(byte[] array,
int start,
int len,
long buf)
Unsafe version of:
SetByteArrayRegion(byte[], int, java.nio.ByteBuffer) |
static void |
nSetCharArrayRegion(char[] array,
int start,
int len,
long buf)
Unsafe version of:
SetCharArrayRegion(char[], int, java.nio.ShortBuffer) |
static void |
nSetDoubleArrayRegion(double[] array,
int start,
int len,
long buf)
Unsafe version of:
SetDoubleArrayRegion(double[], int, java.nio.DoubleBuffer) |
static void |
nSetFloatArrayRegion(float[] array,
int start,
int len,
long buf)
Unsafe version of:
SetFloatArrayRegion(float[], int, java.nio.FloatBuffer) |
static void |
nSetIntArrayRegion(int[] array,
int start,
int len,
long buf)
Unsafe version of:
SetIntArrayRegion(int[], int, java.nio.IntBuffer) |
static void |
nSetLongArrayRegion(long[] array,
int start,
int len,
long buf)
Unsafe version of:
SetLongArrayRegion(long[], int, java.nio.LongBuffer) |
static void |
nSetShortArrayRegion(short[] array,
int start,
int len,
long buf)
Unsafe version of:
SetShortArrayRegion(short[], int, java.nio.ShortBuffer) |
static java.lang.reflect.Field |
nToReflectedField(java.lang.Class<?> cls,
long fieldID,
boolean isStatic)
Unsafe version of:
ToReflectedField(java.lang.Class<?>, long, boolean) |
static java.lang.reflect.Method |
nToReflectedMethod(java.lang.Class<?> cls,
long methodID,
boolean isStatic)
Unsafe version of:
ToReflectedMethod(java.lang.Class<?>, long, boolean) |
static int |
RegisterNatives(java.lang.Class<?> targetClass,
JNINativeMethod.Buffer methods)
Registers native methods with the class specified by the
targetClass argument. |
static void |
ReleaseBooleanArrayElements(byte[] array,
java.nio.ByteBuffer elems,
int mode)
Informs the VM that the native code no longer needs access to
elems. |
static void |
ReleaseByteArrayElements(byte[] array,
java.nio.ByteBuffer elems,
int mode)
Informs the VM that the native code no longer needs access to
elems. |
static void |
ReleaseCharArrayElements(char[] array,
java.nio.ShortBuffer elems,
int mode)
Informs the VM that the native code no longer needs access to
elems. |
static void |
ReleaseDoubleArrayElements(double[] array,
java.nio.DoubleBuffer elems,
int mode)
Informs the VM that the native code no longer needs access to
elems. |
static void |
ReleaseFloatArrayElements(float[] array,
java.nio.FloatBuffer elems,
int mode)
Informs the VM that the native code no longer needs access to
elems. |
static void |
ReleaseIntArrayElements(int[] array,
java.nio.IntBuffer elems,
int mode)
Informs the VM that the native code no longer needs access to
elems. |
static void |
ReleaseLongArrayElements(long[] array,
java.nio.LongBuffer elems,
int mode)
Informs the VM that the native code no longer needs access to
elems. |
static void |
ReleaseShortArrayElements(short[] array,
java.nio.ShortBuffer elems,
int mode)
Informs the VM that the native code no longer needs access to
elems. |
static void |
SetBooleanArrayRegion(byte[] array,
int start,
java.nio.ByteBuffer buf)
Copies back a region of a primitive array from a buffer.
|
static void |
SetByteArrayRegion(byte[] array,
int start,
java.nio.ByteBuffer buf)
Copies back a region of a primitive array from a buffer.
|
static void |
SetCharArrayRegion(char[] array,
int start,
java.nio.ShortBuffer buf)
Copies back a region of a primitive array from a buffer.
|
static void |
SetDoubleArrayRegion(double[] array,
int start,
java.nio.DoubleBuffer buf)
Copies back a region of a primitive array from a buffer.
|
static void |
SetFloatArrayRegion(float[] array,
int start,
java.nio.FloatBuffer buf)
Copies back a region of a primitive array from a buffer.
|
static void |
SetIntArrayRegion(int[] array,
int start,
java.nio.IntBuffer buf)
Copies back a region of a primitive array from a buffer.
|
static void |
SetLongArrayRegion(long[] array,
int start,
java.nio.LongBuffer buf)
Copies back a region of a primitive array from a buffer.
|
static void |
SetShortArrayRegion(short[] array,
int start,
java.nio.ShortBuffer buf)
Copies back a region of a primitive array from a buffer.
|
static java.lang.reflect.Field |
ToReflectedField(java.lang.Class<?> cls,
long fieldID,
boolean isStatic)
Converts a field ID derived from
cls to a Field object. |
static java.lang.reflect.Method |
ToReflectedMethod(java.lang.Class<?> cls,
long methodID,
boolean isStatic)
Converts a method ID derived from
cls to a Method or Constructor object. |
static int |
UnregisterNatives(java.lang.Class<?> targetClass)
Unregisters native methods of a class.
|
public static final int JNI_VERSION_1_1
public static final int JNI_VERSION_1_2
public static final int JNI_VERSION_1_4
public static final int JNI_VERSION_1_6
public static final int JNI_VERSION_1_8
public static final int JNI_VERSION_9
public static final int JNI_VERSION_10
public static final int JNIInvalidRefType
public static final int JNILocalRefType
public static final int JNIGlobalRefType
public static final int JNIWeakGlobalRefType
public static final int JNI_FALSE
public static final int JNI_TRUE
public static final int JNI_OK
public static final int JNI_ERR
public static final int JNI_EDETACHED
public static final int JNI_EVERSION
public static final int JNI_ENOMEM
public static final int JNI_EEXIST
public static final int JNI_EINVAL
public static final int JNI_COMMIT
ReleaseScalarArrayElements.public static final int JNI_ABORT
ReleaseScalarArrayElements.public static int GetVersion()
public static long FromReflectedMethod(java.lang.reflect.Method method)
Method or Constructor object to a method ID.public static long FromReflectedField(java.lang.reflect.Field field)
Field to a field ID.@Nullable
public static java.lang.reflect.Method nToReflectedMethod(java.lang.Class<?> cls,
long methodID,
boolean isStatic)
ToReflectedMethod(java.lang.Class<?>, long, boolean)@Nullable
public static java.lang.reflect.Method ToReflectedMethod(java.lang.Class<?> cls,
long methodID,
boolean isStatic)
cls to a Method or Constructor object.isStatic - must be set to TRUE if the method ID refers to a static field, and # FALSE otherwise@Nullable
public static java.lang.reflect.Field nToReflectedField(java.lang.Class<?> cls,
long fieldID,
boolean isStatic)
ToReflectedField(java.lang.Class<?>, long, boolean)@Nullable
public static java.lang.reflect.Field ToReflectedField(java.lang.Class<?> cls,
long fieldID,
boolean isStatic)
cls to a Field object.public static long NewGlobalRef(java.lang.Object obj)
obj argument. The obj argument may be a global or local reference.
Global references must be explicitly disposed of by calling DeleteGlobalRef(long).obj - a global or local referenceNULL if the system runs out of memorypublic static void nDeleteGlobalRef(long globalRef)
DeleteGlobalRef(long)public static void DeleteGlobalRef(long globalRef)
globalRef.globalRef - a global referencepublic static long nGetBooleanArrayElements(byte[] array,
long isCopy)
GetBooleanArrayElements(byte[], java.nio.ByteBuffer)@Nullable
public static java.nio.ByteBuffer GetBooleanArrayElements(byte[] array,
@Nullable
java.nio.ByteBuffer isCopy)
ReleaseBooleanArrayElements(byte[], java.nio.ByteBuffer, int) function is called. Since the returned array
may be a copy of the Java array, changes made to the returned array will not necessarily be reflected in the original array until
ReleaseBooleanArrayElements(byte[], java.nio.ByteBuffer, int) is called.
If isCopy is not NULL, then *isCopy is set to TRUE if a copy is made; or it is set to FALSE if no copy is made.
array - the primitive arrayisCopy - a pointer to a booleanNULL if the operation failspublic static void nReleaseBooleanArrayElements(byte[] array,
long elems,
int mode)
ReleaseBooleanArrayElements(byte[], java.nio.ByteBuffer, int)public static void ReleaseBooleanArrayElements(byte[] array,
java.nio.ByteBuffer elems,
int mode)
elems. The elems argument is a pointer derived from array using the
GetBooleanArrayElements(byte[], java.nio.ByteBuffer) function. If necessary, this function copies back all changes made to elems to the original array.
The mode argument provides information on how the array buffer should be released. mode has no effect if elems is not a
copy of the elements in array. Otherwise, mode has the following impact, as shown in the following table:
| mode | actions |
|---|---|
| 0 | copy back the content and free the elems buffer |
COMMIT | copy back the content but do not free the elems buffer |
ABORT | free the buffer without copying back the possible changes |
In most cases, programmers pass “0” to the mode argument to ensure consistent behavior for both pinned and copied arrays. The other options give the programmer more control over memory management and should be used with extreme care.
public static long nGetByteArrayElements(byte[] array,
long isCopy)
GetByteArrayElements(byte[], java.nio.ByteBuffer)@Nullable
public static java.nio.ByteBuffer GetByteArrayElements(byte[] array,
@Nullable
java.nio.ByteBuffer isCopy)
ReleaseByteArrayElements(byte[], java.nio.ByteBuffer, int) function is called. Since the returned array
may be a copy of the Java array, changes made to the returned array will not necessarily be reflected in the original array until
ReleaseByteArrayElements(byte[], java.nio.ByteBuffer, int) is called.
If isCopy is not NULL, then *isCopy is set to TRUE if a copy is made; or it is set to FALSE if no copy is made.
array - the primitive arrayisCopy - a pointer to a booleanNULL if the operation failspublic static void nReleaseByteArrayElements(byte[] array,
long elems,
int mode)
ReleaseByteArrayElements(byte[], java.nio.ByteBuffer, int)public static void ReleaseByteArrayElements(byte[] array,
java.nio.ByteBuffer elems,
int mode)
elems. The elems argument is a pointer derived from array using the
GetByteArrayElements(byte[], java.nio.ByteBuffer) function. If necessary, this function copies back all changes made to elems to the original array.
The mode argument provides information on how the array buffer should be released. mode has no effect if elems is not a
copy of the elements in array. Otherwise, mode has the following impact, as shown in the following table:
| mode | actions |
|---|---|
| 0 | copy back the content and free the elems buffer |
COMMIT | copy back the content but do not free the elems buffer |
ABORT | free the buffer without copying back the possible changes |
In most cases, programmers pass “0” to the mode argument to ensure consistent behavior for both pinned and copied arrays. The other options give the programmer more control over memory management and should be used with extreme care.
public static long nGetCharArrayElements(char[] array,
long isCopy)
GetCharArrayElements(char[], java.nio.ByteBuffer)@Nullable
public static java.nio.ShortBuffer GetCharArrayElements(char[] array,
@Nullable
java.nio.ByteBuffer isCopy)
ReleaseCharArrayElements(char[], java.nio.ShortBuffer, int) function is called. Since the returned array
may be a copy of the Java array, changes made to the returned array will not necessarily be reflected in the original array until
ReleaseCharArrayElements(char[], java.nio.ShortBuffer, int) is called.
If isCopy is not NULL, then *isCopy is set to TRUE if a copy is made; or it is set to FALSE if no copy is made.
array - the primitive arrayisCopy - a pointer to a booleanNULL if the operation failspublic static void nReleaseCharArrayElements(char[] array,
long elems,
int mode)
ReleaseCharArrayElements(char[], java.nio.ShortBuffer, int)public static void ReleaseCharArrayElements(char[] array,
java.nio.ShortBuffer elems,
int mode)
elems. The elems argument is a pointer derived from array using the
GetCharArrayElements(char[], java.nio.ByteBuffer) function. If necessary, this function copies back all changes made to elems to the original array.
The mode argument provides information on how the array buffer should be released. mode has no effect if elems is not a
copy of the elements in array. Otherwise, mode has the following impact, as shown in the following table:
| mode | actions |
|---|---|
| 0 | copy back the content and free the elems buffer |
COMMIT | copy back the content but do not free the elems buffer |
ABORT | free the buffer without copying back the possible changes |
In most cases, programmers pass “0” to the mode argument to ensure consistent behavior for both pinned and copied arrays. The other options give the programmer more control over memory management and should be used with extreme care.
public static long nGetShortArrayElements(short[] array,
long isCopy)
GetShortArrayElements(short[], java.nio.ByteBuffer)@Nullable
public static java.nio.ShortBuffer GetShortArrayElements(short[] array,
@Nullable
java.nio.ByteBuffer isCopy)
ReleaseShortArrayElements(short[], java.nio.ShortBuffer, int) function is called. Since the returned array
may be a copy of the Java array, changes made to the returned array will not necessarily be reflected in the original array until
ReleaseShortArrayElements(short[], java.nio.ShortBuffer, int) is called.
If isCopy is not NULL, then *isCopy is set to TRUE if a copy is made; or it is set to FALSE if no copy is made.
array - the primitive arrayisCopy - a pointer to a booleanNULL if the operation failspublic static void nReleaseShortArrayElements(short[] array,
long elems,
int mode)
ReleaseShortArrayElements(short[], java.nio.ShortBuffer, int)public static void ReleaseShortArrayElements(short[] array,
java.nio.ShortBuffer elems,
int mode)
elems. The elems argument is a pointer derived from array using the
GetShortArrayElements(short[], java.nio.ByteBuffer) function. If necessary, this function copies back all changes made to elems to the original array.
The mode argument provides information on how the array buffer should be released. mode has no effect if elems is not a
copy of the elements in array. Otherwise, mode has the following impact, as shown in the following table:
| mode | actions |
|---|---|
| 0 | copy back the content and free the elems buffer |
COMMIT | copy back the content but do not free the elems buffer |
ABORT | free the buffer without copying back the possible changes |
In most cases, programmers pass “0” to the mode argument to ensure consistent behavior for both pinned and copied arrays. The other options give the programmer more control over memory management and should be used with extreme care.
public static long nGetIntArrayElements(int[] array,
long isCopy)
GetIntArrayElements(int[], java.nio.ByteBuffer)@Nullable
public static java.nio.IntBuffer GetIntArrayElements(int[] array,
@Nullable
java.nio.ByteBuffer isCopy)
ReleaseIntArrayElements(int[], java.nio.IntBuffer, int) function is called. Since the returned array
may be a copy of the Java array, changes made to the returned array will not necessarily be reflected in the original array until
ReleaseIntArrayElements(int[], java.nio.IntBuffer, int) is called.
If isCopy is not NULL, then *isCopy is set to TRUE if a copy is made; or it is set to FALSE if no copy is made.
array - the primitive arrayisCopy - a pointer to a booleanNULL if the operation failspublic static void nReleaseIntArrayElements(int[] array,
long elems,
int mode)
ReleaseIntArrayElements(int[], java.nio.IntBuffer, int)public static void ReleaseIntArrayElements(int[] array,
java.nio.IntBuffer elems,
int mode)
elems. The elems argument is a pointer derived from array using the
GetIntArrayElements(int[], java.nio.ByteBuffer) function. If necessary, this function copies back all changes made to elems to the original array.
The mode argument provides information on how the array buffer should be released. mode has no effect if elems is not a
copy of the elements in array. Otherwise, mode has the following impact, as shown in the following table:
| mode | actions |
|---|---|
| 0 | copy back the content and free the elems buffer |
COMMIT | copy back the content but do not free the elems buffer |
ABORT | free the buffer without copying back the possible changes |
In most cases, programmers pass “0” to the mode argument to ensure consistent behavior for both pinned and copied arrays. The other options give the programmer more control over memory management and should be used with extreme care.
public static long nGetLongArrayElements(long[] array,
long isCopy)
GetLongArrayElements(long[], java.nio.ByteBuffer)@Nullable
public static java.nio.LongBuffer GetLongArrayElements(long[] array,
@Nullable
java.nio.ByteBuffer isCopy)
ReleaseLongArrayElements(long[], java.nio.LongBuffer, int) function is called. Since the returned array
may be a copy of the Java array, changes made to the returned array will not necessarily be reflected in the original array until
ReleaseLongArrayElements(long[], java.nio.LongBuffer, int) is called.
If isCopy is not NULL, then *isCopy is set to TRUE if a copy is made; or it is set to FALSE if no copy is made.
array - the primitive arrayisCopy - a pointer to a booleanNULL if the operation failspublic static void nReleaseLongArrayElements(long[] array,
long elems,
int mode)
ReleaseLongArrayElements(long[], java.nio.LongBuffer, int)public static void ReleaseLongArrayElements(long[] array,
java.nio.LongBuffer elems,
int mode)
elems. The elems argument is a pointer derived from array using the
GetLongArrayElements(long[], java.nio.ByteBuffer) function. If necessary, this function copies back all changes made to elems to the original array.
The mode argument provides information on how the array buffer should be released. mode has no effect if elems is not a
copy of the elements in array. Otherwise, mode has the following impact, as shown in the following table:
| mode | actions |
|---|---|
| 0 | copy back the content and free the elems buffer |
COMMIT | copy back the content but do not free the elems buffer |
ABORT | free the buffer without copying back the possible changes |
In most cases, programmers pass “0” to the mode argument to ensure consistent behavior for both pinned and copied arrays. The other options give the programmer more control over memory management and should be used with extreme care.
public static long nGetFloatArrayElements(float[] array,
long isCopy)
GetFloatArrayElements(float[], java.nio.ByteBuffer)@Nullable
public static java.nio.FloatBuffer GetFloatArrayElements(float[] array,
@Nullable
java.nio.ByteBuffer isCopy)
ReleaseFloatArrayElements(float[], java.nio.FloatBuffer, int) function is called. Since the returned array
may be a copy of the Java array, changes made to the returned array will not necessarily be reflected in the original array until
ReleaseFloatArrayElements(float[], java.nio.FloatBuffer, int) is called.
If isCopy is not NULL, then *isCopy is set to TRUE if a copy is made; or it is set to FALSE if no copy is made.
array - the primitive arrayisCopy - a pointer to a booleanNULL if the operation failspublic static void nReleaseFloatArrayElements(float[] array,
long elems,
int mode)
ReleaseFloatArrayElements(float[], java.nio.FloatBuffer, int)public static void ReleaseFloatArrayElements(float[] array,
java.nio.FloatBuffer elems,
int mode)
elems. The elems argument is a pointer derived from array using the
GetFloatArrayElements(float[], java.nio.ByteBuffer) function. If necessary, this function copies back all changes made to elems to the original array.
The mode argument provides information on how the array buffer should be released. mode has no effect if elems is not a
copy of the elements in array. Otherwise, mode has the following impact, as shown in the following table:
| mode | actions |
|---|---|
| 0 | copy back the content and free the elems buffer |
COMMIT | copy back the content but do not free the elems buffer |
ABORT | free the buffer without copying back the possible changes |
In most cases, programmers pass “0” to the mode argument to ensure consistent behavior for both pinned and copied arrays. The other options give the programmer more control over memory management and should be used with extreme care.
public static long nGetDoubleArrayElements(double[] array,
long isCopy)
GetDoubleArrayElements(double[], java.nio.ByteBuffer)@Nullable
public static java.nio.DoubleBuffer GetDoubleArrayElements(double[] array,
@Nullable
java.nio.ByteBuffer isCopy)
ReleaseDoubleArrayElements(double[], java.nio.DoubleBuffer, int) function is called. Since the returned array
may be a copy of the Java array, changes made to the returned array will not necessarily be reflected in the original array until
ReleaseDoubleArrayElements(double[], java.nio.DoubleBuffer, int) is called.
If isCopy is not NULL, then *isCopy is set to TRUE if a copy is made; or it is set to FALSE if no copy is made.
array - the primitive arrayisCopy - a pointer to a booleanNULL if the operation failspublic static void nReleaseDoubleArrayElements(double[] array,
long elems,
int mode)
ReleaseDoubleArrayElements(double[], java.nio.DoubleBuffer, int)public static void ReleaseDoubleArrayElements(double[] array,
java.nio.DoubleBuffer elems,
int mode)
elems. The elems argument is a pointer derived from array using the
GetDoubleArrayElements(double[], java.nio.ByteBuffer) function. If necessary, this function copies back all changes made to elems to the original array.
The mode argument provides information on how the array buffer should be released. mode has no effect if elems is not a
copy of the elements in array. Otherwise, mode has the following impact, as shown in the following table:
| mode | actions |
|---|---|
| 0 | copy back the content and free the elems buffer |
COMMIT | copy back the content but do not free the elems buffer |
ABORT | free the buffer without copying back the possible changes |
In most cases, programmers pass “0” to the mode argument to ensure consistent behavior for both pinned and copied arrays. The other options give the programmer more control over memory management and should be used with extreme care.
public static void nGetBooleanArrayRegion(byte[] array,
int start,
int len,
long buf)
GetBooleanArrayRegion(byte[], int, java.nio.ByteBuffer)len - the number of elements to be copiedpublic static void GetBooleanArrayRegion(byte[] array,
int start,
java.nio.ByteBuffer buf)
array - a Java arraystart - the starting indexbuf - the destination bufferpublic static void nSetBooleanArrayRegion(byte[] array,
int start,
int len,
long buf)
SetBooleanArrayRegion(byte[], int, java.nio.ByteBuffer)len - the number of elements to be copiedpublic static void SetBooleanArrayRegion(byte[] array,
int start,
java.nio.ByteBuffer buf)
array - a Java arraystart - the starting indexbuf - the source bufferpublic static void nGetByteArrayRegion(byte[] array,
int start,
int len,
long buf)
GetByteArrayRegion(byte[], int, java.nio.ByteBuffer)len - the number of elements to be copiedpublic static void GetByteArrayRegion(byte[] array,
int start,
java.nio.ByteBuffer buf)
array - a Java arraystart - the starting indexbuf - the destination bufferpublic static void nSetByteArrayRegion(byte[] array,
int start,
int len,
long buf)
SetByteArrayRegion(byte[], int, java.nio.ByteBuffer)len - the number of elements to be copiedpublic static void SetByteArrayRegion(byte[] array,
int start,
java.nio.ByteBuffer buf)
array - a Java arraystart - the starting indexbuf - the source bufferpublic static void nGetCharArrayRegion(char[] array,
int start,
int len,
long buf)
GetCharArrayRegion(char[], int, java.nio.ShortBuffer)len - the number of elements to be copiedpublic static void GetCharArrayRegion(char[] array,
int start,
java.nio.ShortBuffer buf)
array - a Java arraystart - the starting indexbuf - the destination bufferpublic static void nSetCharArrayRegion(char[] array,
int start,
int len,
long buf)
SetCharArrayRegion(char[], int, java.nio.ShortBuffer)len - the number of elements to be copiedpublic static void SetCharArrayRegion(char[] array,
int start,
java.nio.ShortBuffer buf)
array - a Java arraystart - the starting indexbuf - the source bufferpublic static void nGetShortArrayRegion(short[] array,
int start,
int len,
long buf)
GetShortArrayRegion(short[], int, java.nio.ShortBuffer)len - the number of elements to be copiedpublic static void GetShortArrayRegion(short[] array,
int start,
java.nio.ShortBuffer buf)
array - a Java arraystart - the starting indexbuf - the destination bufferpublic static void nSetShortArrayRegion(short[] array,
int start,
int len,
long buf)
SetShortArrayRegion(short[], int, java.nio.ShortBuffer)len - the number of elements to be copiedpublic static void SetShortArrayRegion(short[] array,
int start,
java.nio.ShortBuffer buf)
array - a Java arraystart - the starting indexbuf - the source bufferpublic static void nGetIntArrayRegion(int[] array,
int start,
int len,
long buf)
GetIntArrayRegion(int[], int, java.nio.IntBuffer)len - the number of elements to be copiedpublic static void GetIntArrayRegion(int[] array,
int start,
java.nio.IntBuffer buf)
array - a Java arraystart - the starting indexbuf - the destination bufferpublic static void nSetIntArrayRegion(int[] array,
int start,
int len,
long buf)
SetIntArrayRegion(int[], int, java.nio.IntBuffer)len - the number of elements to be copiedpublic static void SetIntArrayRegion(int[] array,
int start,
java.nio.IntBuffer buf)
array - a Java arraystart - the starting indexbuf - the source bufferpublic static void nGetLongArrayRegion(long[] array,
int start,
int len,
long buf)
GetLongArrayRegion(long[], int, java.nio.LongBuffer)len - the number of elements to be copiedpublic static void GetLongArrayRegion(long[] array,
int start,
java.nio.LongBuffer buf)
array - a Java arraystart - the starting indexbuf - the destination bufferpublic static void nSetLongArrayRegion(long[] array,
int start,
int len,
long buf)
SetLongArrayRegion(long[], int, java.nio.LongBuffer)len - the number of elements to be copiedpublic static void SetLongArrayRegion(long[] array,
int start,
java.nio.LongBuffer buf)
array - a Java arraystart - the starting indexbuf - the source bufferpublic static void nGetFloatArrayRegion(float[] array,
int start,
int len,
long buf)
GetFloatArrayRegion(float[], int, java.nio.FloatBuffer)len - the number of elements to be copiedpublic static void GetFloatArrayRegion(float[] array,
int start,
java.nio.FloatBuffer buf)
array - a Java arraystart - the starting indexbuf - the destination bufferpublic static void nSetFloatArrayRegion(float[] array,
int start,
int len,
long buf)
SetFloatArrayRegion(float[], int, java.nio.FloatBuffer)len - the number of elements to be copiedpublic static void SetFloatArrayRegion(float[] array,
int start,
java.nio.FloatBuffer buf)
array - a Java arraystart - the starting indexbuf - the source bufferpublic static void nGetDoubleArrayRegion(double[] array,
int start,
int len,
long buf)
GetDoubleArrayRegion(double[], int, java.nio.DoubleBuffer)len - the number of elements to be copiedpublic static void GetDoubleArrayRegion(double[] array,
int start,
java.nio.DoubleBuffer buf)
array - a Java arraystart - the starting indexbuf - the destination bufferpublic static void nSetDoubleArrayRegion(double[] array,
int start,
int len,
long buf)
SetDoubleArrayRegion(double[], int, java.nio.DoubleBuffer)len - the number of elements to be copiedpublic static void SetDoubleArrayRegion(double[] array,
int start,
java.nio.DoubleBuffer buf)
array - a Java arraystart - the starting indexbuf - the source bufferpublic static int nRegisterNatives(java.lang.Class<?> targetClass,
long methods,
int nMethods)
nMethods - the number of native methods in the classpublic static int RegisterNatives(java.lang.Class<?> targetClass,
JNINativeMethod.Buffer methods)
targetClass argument. The methods parameter specifies an array of JNINativeMethod
structures that contain the names, signatures, and function pointers of the native methods. The name and signature fields of the JNINativeMethod
structure are pointers to modified UTF-8 strings. The nMethods parameter specifies the number of native methods in the array.methods - the native methods in the classpublic static int UnregisterNatives(java.lang.Class<?> targetClass)
This function should not be used in normal native code. Instead, it provides special programs a way to reload and relink native libraries.
targetClass - a Java class objectpublic static int nGetJavaVM(long vm)
GetJavaVM(org.lwjgl.PointerBuffer)public static int GetJavaVM(org.lwjgl.PointerBuffer vm)
vm.vm - a pointer to where the result should be placedpublic static void nGetStringRegion(java.lang.String str,
int start,
int len,
long buf)
GetStringRegion(java.lang.String, int, java.nio.ByteBuffer)public static void GetStringRegion(java.lang.String str,
int start,
java.nio.ByteBuffer buf)
len number of Unicode characters beginning at offset start to the given buffer buf.public static void nGetStringUTFRegion(java.lang.String str,
int start,
int len,
long buf)
GetStringUTFRegion(java.lang.String, int, int, java.nio.ByteBuffer)public static void GetStringUTFRegion(java.lang.String str,
int start,
int len,
java.nio.ByteBuffer buf)
len number of Unicode characters beginning at offset start into modified UTF-8 encoding and place the result in the given buffer
buf.public static long NewWeakGlobalRef(java.lang.Object obj)
NULL if obj refers to null, or if the VM runs out of memory. If the VM runs out of memory, an
OutOfMemoryError will be thrown.public static void nDeleteWeakGlobalRef(long weakGlobalRef)
DeleteWeakGlobalRef(long)public static void DeleteWeakGlobalRef(long weakGlobalRef)
@Nullable
public static java.nio.ByteBuffer nNewDirectByteBuffer(long address,
long capacity)
NewDirectByteBuffer(long, long)@Nullable
public static java.nio.ByteBuffer NewDirectByteBuffer(long address,
long capacity)
java.nio.ByteBuffer referring to the block of memory starting at the memory address address and extending
capacity bytes.
Native code that calls this function and returns the resulting byte-buffer object to Java-level code should ensure that the buffer refers to a valid region of memory that is accessible for reading and, if appropriate, writing. An attempt to access an invalid memory location from Java code will either return an arbitrary value, have no visible effect, or cause an unspecified exception to be thrown.
address - the starting address of the memory region (must not be NULL)capacity - the size in bytes of the memory region (must be positive)java.nio.ByteBuffer object. Returns NULL if an exception occurs, or if JNI access to direct
buffers is not supported by this virtual machine.public static long GetDirectBufferAddress(java.nio.Buffer buf)
java.nio.Buffer.
This function allows native code to access the same memory region that is accessible to Java code via the buffer object.
buf - a direct java.nio.Buffer object (must not be NULL)NULL if the memory region is undefined, if the given object is not a
direct java.nio.Buffer, or if JNI access to direct buffers is not supported by this virtual machine.public static int GetObjectRefType(java.lang.Object obj)
obj argument. The argument obj can either be a local, global or weak global
reference.obj - a local, global or weak global referenceCopyright LWJGL. All Rights Reserved. License terms.