Class 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;
     }
    • 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()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class 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()
        Decodes 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()
        Decodes 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
      • createSafe

        @Nullable
        public static JNINativeMethod createSafe​(long address)
        Like create, but returns null if address is NULL.
      • 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.
      • 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
      • validate

        public static void validate​(long array,
                                    int count)
        Calls validate(long) for each struct contained in the specified struct array.
        Parameters:
        array - the struct array to validate
        count - the number of structs in array