Package org.lwjgl.system.jni
Class JNINativeMethod
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.Struct
-
- org.lwjgl.system.jni.JNINativeMethod
-
- All Implemented Interfaces:
- java.lang.AutoCloseable, NativeResource, Pointer
public class JNINativeMethod extends Struct implements NativeResource
Layout
struct JNINativeMethod { char * name; char * signature; void * fnPtr; }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
JNINativeMethod.Buffer
An array ofJNINativeMethod
structs.-
Nested classes/interfaces inherited from interface org.lwjgl.system.Pointer
Pointer.Default
-
-
Field Summary
Fields Modifier and Type Field and Description static int
SIZEOF
The struct size in bytes.-
Fields inherited from interface org.lwjgl.system.Pointer
POINTER_SHIFT, POINTER_SIZE
-
-
Constructor Summary
Constructors Constructor and Description JNINativeMethod(java.nio.ByteBuffer container)
Creates aJNINativeMethod
instance at the current position of the specifiedByteBuffer
container.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static JNINativeMethod
calloc()
Returns a newJNINativeMethod
instance allocated withmemCalloc
.static JNINativeMethod.Buffer
calloc(int capacity)
Returns a newJNINativeMethod.Buffer
instance allocated withmemCalloc
.static JNINativeMethod
callocStack()
Returns a newJNINativeMethod
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.static JNINativeMethod.Buffer
callocStack(int capacity)
Returns a newJNINativeMethod.Buffer
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.static JNINativeMethod.Buffer
callocStack(int capacity, MemoryStack stack)
Returns a newJNINativeMethod.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.static JNINativeMethod
callocStack(MemoryStack stack)
Returns a newJNINativeMethod
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.static JNINativeMethod
create()
Returns a newJNINativeMethod
instance allocated withBufferUtils
.static JNINativeMethod.Buffer
create(int capacity)
Returns a newJNINativeMethod.Buffer
instance allocated withBufferUtils
.static JNINativeMethod
create(long address)
Returns a newJNINativeMethod
instance for the specified memory address ornull
if the address isNULL
.static JNINativeMethod.Buffer
create(long address, int capacity)
Create aJNINativeMethod.Buffer
instance at the specified memory.long
fnPtr()
Returns the value of thefnPtr
field.JNINativeMethod
fnPtr(long value)
Sets the specified value to thefnPtr
field.static JNINativeMethod
malloc()
Returns a newJNINativeMethod
instance allocated withmemAlloc
.static JNINativeMethod.Buffer
malloc(int capacity)
Returns a newJNINativeMethod.Buffer
instance allocated withmemAlloc
.static JNINativeMethod
mallocStack()
Returns a newJNINativeMethod
instance allocated on the thread-localMemoryStack
.static JNINativeMethod.Buffer
mallocStack(int capacity)
Returns a newJNINativeMethod.Buffer
instance allocated on the thread-localMemoryStack
.static JNINativeMethod.Buffer
mallocStack(int capacity, MemoryStack stack)
Returns a newJNINativeMethod.Buffer
instance allocated on the specifiedMemoryStack
.static JNINativeMethod
mallocStack(MemoryStack stack)
Returns a newJNINativeMethod
instance allocated on the specifiedMemoryStack
.java.nio.ByteBuffer
name()
Returns aByteBuffer
view of the null-terminated string pointed to by thename
field.JNINativeMethod
name(java.nio.ByteBuffer value)
Sets the address of the specified encoded string to thename
field.java.lang.String
nameString()
Decodes the null-terminated string pointed to by thename
field.JNINativeMethod
set(java.nio.ByteBuffer name, java.nio.ByteBuffer signature, long fnPtr)
Initializes this struct with the specified values.JNINativeMethod
set(JNINativeMethod src)
Copies the specified struct data to this struct.java.nio.ByteBuffer
signature()
Returns aByteBuffer
view of the null-terminated string pointed to by thesignature
field.JNINativeMethod
signature(java.nio.ByteBuffer value)
Sets the address of the specified encoded string to thesignature
field.java.lang.String
signatureString()
Decodes the null-terminated string pointed to by thesignature
field.int
sizeof()
Returnssizeof(struct)
.static void
validate(long struct)
Validates pointer members that should not beNULL
.static void
validate(long array, int count)
CallsJNINativeMethod.validate(long)
for each struct contained in the specified struct array.-
Methods inherited from class org.lwjgl.system.Pointer.Default
address, equals, hashCode, toString
-
Methods inherited from interface org.lwjgl.system.NativeResource
close, free
-
-
-
-
Constructor Detail
-
JNINativeMethod
public JNINativeMethod(java.nio.ByteBuffer container)
Creates aJNINativeMethod
instance at the current position of the specifiedByteBuffer
container. Changes to the buffer's content will be visible to the struct instance and vice versa.The created instance holds a strong reference to the container object.
-
-
Method Detail
-
sizeof
public int sizeof()
Description copied from class:Struct
Returnssizeof(struct)
.
-
name
public java.nio.ByteBuffer name()
Returns aByteBuffer
view of the null-terminated string pointed to by thename
field.
-
nameString
public java.lang.String nameString()
Decodes the null-terminated string pointed to by thename
field.
-
signature
public java.nio.ByteBuffer signature()
Returns aByteBuffer
view of the null-terminated string pointed to by thesignature
field.
-
signatureString
public java.lang.String signatureString()
Decodes the null-terminated string pointed to by thesignature
field.
-
fnPtr
public long fnPtr()
Returns the value of thefnPtr
field.
-
name
public JNINativeMethod name(java.nio.ByteBuffer value)
Sets the address of the specified encoded string to thename
field.
-
signature
public JNINativeMethod signature(java.nio.ByteBuffer value)
Sets the address of the specified encoded string to thesignature
field.
-
fnPtr
public JNINativeMethod fnPtr(long value)
Sets the specified value to thefnPtr
field.
-
set
public JNINativeMethod set(java.nio.ByteBuffer name, java.nio.ByteBuffer signature, long fnPtr)
Initializes this struct with the specified values.
-
set
public JNINativeMethod set(JNINativeMethod src)
Copies the specified struct data to this struct.- Parameters:
src
- the source struct- Returns:
- this struct
-
malloc
public static JNINativeMethod malloc()
Returns a newJNINativeMethod
instance allocated withmemAlloc
. The instance must be explicitly freed.
-
calloc
public static JNINativeMethod calloc()
Returns a newJNINativeMethod
instance allocated withmemCalloc
. The instance must be explicitly freed.
-
create
public static JNINativeMethod create()
Returns a newJNINativeMethod
instance allocated withBufferUtils
.
-
create
public static JNINativeMethod create(long address)
Returns a newJNINativeMethod
instance for the specified memory address ornull
if the address isNULL
.
-
malloc
public static JNINativeMethod.Buffer malloc(int capacity)
Returns a newJNINativeMethod.Buffer
instance allocated withmemAlloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
calloc
public static JNINativeMethod.Buffer calloc(int capacity)
Returns a newJNINativeMethod.Buffer
instance allocated withmemCalloc
. The instance must be explicitly freed.- Parameters:
capacity
- the buffer capacity
-
create
public static JNINativeMethod.Buffer create(int capacity)
Returns a newJNINativeMethod.Buffer
instance allocated withBufferUtils
.- Parameters:
capacity
- the buffer capacity
-
create
public static JNINativeMethod.Buffer create(long address, int capacity)
Create aJNINativeMethod.Buffer
instance at the specified memory.- Parameters:
address
- the memory addresscapacity
- the buffer capacity
-
mallocStack
public static JNINativeMethod mallocStack()
Returns a newJNINativeMethod
instance allocated on the thread-localMemoryStack
.
-
callocStack
public static JNINativeMethod callocStack()
Returns a newJNINativeMethod
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.
-
mallocStack
public static JNINativeMethod mallocStack(MemoryStack stack)
Returns a newJNINativeMethod
instance allocated on the specifiedMemoryStack
.- Parameters:
stack
- the stack from which to allocate
-
callocStack
public static JNINativeMethod callocStack(MemoryStack stack)
Returns a newJNINativeMethod
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.- Parameters:
stack
- the stack from which to allocate
-
mallocStack
public static JNINativeMethod.Buffer mallocStack(int capacity)
Returns a newJNINativeMethod.Buffer
instance allocated on the thread-localMemoryStack
.- Parameters:
capacity
- the buffer capacity
-
callocStack
public static JNINativeMethod.Buffer callocStack(int capacity)
Returns a newJNINativeMethod.Buffer
instance allocated on the thread-localMemoryStack
and initializes all its bits to zero.- Parameters:
capacity
- the buffer capacity
-
mallocStack
public static JNINativeMethod.Buffer mallocStack(int capacity, MemoryStack stack)
Returns a newJNINativeMethod.Buffer
instance allocated on the specifiedMemoryStack
.- Parameters:
stack
- the stack from which to allocatecapacity
- the buffer capacity
-
callocStack
public static JNINativeMethod.Buffer callocStack(int capacity, MemoryStack stack)
Returns a newJNINativeMethod.Buffer
instance allocated on the specifiedMemoryStack
and initializes all its bits to zero.- Parameters:
stack
- the stack from which to allocatecapacity
- the buffer capacity
-
validate
public static void validate(long struct)
Validates pointer members that should not beNULL
.- Parameters:
struct
- the struct to validate
-
validate
public static void validate(long array, int count)
CallsJNINativeMethod.validate(long)
for each struct contained in the specified struct array.- Parameters:
array
- the struct array to validatecount
- the number of structs inarray
-
-