Class AIString

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class AIString
    extends Struct
    implements NativeResource
    Represents an UTF-8 string, zero byte terminated.

    Member documentation

    • length – Binary length of the string excluding the terminal 0.
    • data – String buffer.

    Layout

    
     struct aiString {
         size_t length;
         char data[Assimp.MAXLEN];
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • LENGTH, DATA

        The struct member offsets.
    • Constructor Detail

      • AIString

        public AIString​(java.nio.ByteBuffer container)
        Creates a AIString 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
      • length

        public long length()
        Returns the value of the length field.
      • data

        public java.nio.ByteBuffer data()
        Returns a ByteBuffer view of the data field.
      • dataString

        public java.lang.String dataString()
        Decodes the null-terminated string stored in the data field.
      • data

        public AIString data​(java.nio.ByteBuffer value)
        Copies the specified encoded string to the data field.
      • set

        public AIString set​(AIString src)
        Copies the specified struct data to this struct.
        Parameters:
        src - the source struct
        Returns:
        this struct
      • malloc

        public static AIString malloc()
        Returns a new AIString instance allocated with memAlloc. The instance must be explicitly freed.
      • calloc

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

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

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

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

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

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

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

        public static AIString callocStack()
        Returns a new AIString instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

        public static AIString mallocStack​(MemoryStack stack)
        Returns a new AIString instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

        public static AIString callocStack​(MemoryStack stack)
        Returns a new AIString instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

        public static AIString.Buffer callocStack​(int capacity)
        Returns a new AIString.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
        Parameters:
        capacity - the buffer capacity
      • callocStack

        public static AIString.Buffer callocStack​(int capacity,
                                                  MemoryStack stack)
        Returns a new AIString.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
      • nlength

        public static long nlength​(long struct)
        Unsafe version of length().
      • ndata

        public static java.nio.ByteBuffer ndata​(long struct)
        Unsafe version of data().
      • ndataString

        public static java.lang.String ndataString​(long struct)
        Unsafe version of dataString().
      • nlength

        public static void nlength​(long struct,
                                   long value)
        Sets the specified value to the length field of the specified struct.
      • ndata

        public static void ndata​(long struct,
                                 java.nio.ByteBuffer value)
        Unsafe version of data.