Class JNINativeMethod

java.lang.Object
org.lwjgl.system.Pointer.Default
org.lwjgl.system.Struct
org.lwjgl.system.jni.JNINativeMethod
All Implemented Interfaces:
AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer

public class JNINativeMethod extends org.lwjgl.system.Struct implements org.lwjgl.system.NativeResource

Layout


 struct JNINativeMethod {
     char * name;
     char * signature;
     void * fnPtr;
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • NAME

      public static final int NAME
      The struct member offsets.
    • SIGNATURE

      public static final int SIGNATURE
      The struct member offsets.
    • FNPTR

      public static final int FNPTR
      The struct member offsets.
  • Constructor Details

    • JNINativeMethod

      public JNINativeMethod(ByteBuffer container)
      Creates a JNINativeMethod instance at the current position of the specified ByteBuffer 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 Details

    • sizeof

      public int sizeof()
      Specified by:
      sizeof in class org.lwjgl.system.Struct
    • name

      public ByteBuffer name()
      Returns:
      a ByteBuffer view of the null-terminated string pointed to by the name field.
    • nameString

      public String nameString()
      Returns:
      the null-terminated string pointed to by the name field.
    • signature

      public ByteBuffer signature()
      Returns:
      a ByteBuffer view of the null-terminated string pointed to by the signature field.
    • signatureString

      public String signatureString()
      Returns:
      the null-terminated string pointed to by the signature field.
    • fnPtr

      public long fnPtr()
      Returns:
      the value of the fnPtr field.
    • name

      public JNINativeMethod name(ByteBuffer value)
      Sets the address of the specified encoded string to the name field.
    • signature

      public JNINativeMethod signature(ByteBuffer value)
      Sets the address of the specified encoded string to the signature field.
    • fnPtr

      public JNINativeMethod fnPtr(long value)
      Sets the specified value to the fnPtr field.
    • set

      public JNINativeMethod set(ByteBuffer name, 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 new JNINativeMethod instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static JNINativeMethod calloc()
      Returns a new JNINativeMethod instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static JNINativeMethod create()
      Returns a new JNINativeMethod instance allocated with BufferUtils.
    • create

      public static JNINativeMethod create(long address)
      Returns a new JNINativeMethod instance for the specified memory address.
    • createSafe

      @Nullable public static JNINativeMethod createSafe(long address)
      Like create, but returns null if address is NULL.
    • malloc

      public static JNINativeMethod.Buffer malloc(int capacity)
      Returns a new JNINativeMethod.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static JNINativeMethod.Buffer calloc(int capacity)
      Returns a new JNINativeMethod.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static JNINativeMethod.Buffer create(int capacity)
      Returns a new JNINativeMethod.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static JNINativeMethod.Buffer create(long address, int capacity)
      Create a JNINativeMethod.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      @Nullable public static JNINativeMethod.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • mallocStack

      @Deprecated public static JNINativeMethod mallocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static JNINativeMethod callocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • mallocStack

      @Deprecated public static JNINativeMethod mallocStack(org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static JNINativeMethod callocStack(org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • mallocStack

      @Deprecated public static JNINativeMethod.Buffer mallocStack(int capacity)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(int, MemoryStack) instead.
    • callocStack

      @Deprecated public static JNINativeMethod.Buffer callocStack(int capacity)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(int, MemoryStack) instead.
    • mallocStack

      @Deprecated public static JNINativeMethod.Buffer mallocStack(int capacity, org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(int, MemoryStack) instead.
    • callocStack

      @Deprecated public static JNINativeMethod.Buffer callocStack(int capacity, org.lwjgl.system.MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(int, MemoryStack) instead.
    • malloc

      public static JNINativeMethod malloc(org.lwjgl.system.MemoryStack stack)
      Returns a new JNINativeMethod instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static JNINativeMethod calloc(org.lwjgl.system.MemoryStack stack)
      Returns a new JNINativeMethod instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static JNINativeMethod.Buffer malloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new JNINativeMethod.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static JNINativeMethod.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack)
      Returns a new JNINativeMethod.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • nname

      public static ByteBuffer nname(long struct)
      Unsafe version of name().
    • nnameString

      public static String nnameString(long struct)
      Unsafe version of nameString().
    • nsignature

      public static ByteBuffer nsignature(long struct)
      Unsafe version of signature().
    • nsignatureString

      public static String nsignatureString(long struct)
      Unsafe version of signatureString().
    • nfnPtr

      public static long nfnPtr(long struct)
      Unsafe version of fnPtr().
    • nname

      public static void nname(long struct, ByteBuffer value)
      Unsafe version of name.
    • nsignature

      public static void nsignature(long struct, ByteBuffer value)
      Unsafe version of signature.
    • nfnPtr

      public static void nfnPtr(long struct, long value)
      Unsafe version of fnPtr.
    • validate

      public static void validate(long struct)
      Validates pointer members that should not be NULL.
      Parameters:
      struct - the struct to validate