Class JNINativeMethod

  • All Implemented Interfaces:
    java.lang.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 Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • NAME, SIGNATURE, FNPTR

        The struct member offsets.
    • Constructor Detail

      • JNINativeMethod

        public JNINativeMethod​(java.nio.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 Detail

      • sizeof

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

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

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

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

        public java.lang.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​(java.nio.ByteBuffer value)
        Sets the address of the specified encoded string to the name field.
      • signature

        public JNINativeMethod signature​(java.nio.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​(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 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​(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​(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.
      • 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:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • 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:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • nname

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

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

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

        public static java.lang.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,
                                 java.nio.ByteBuffer value)
        Unsafe version of name.
      • nsignature

        public static void nsignature​(long struct,
                                      java.nio.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