Class AIString

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

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

Layout


 struct aiString {
     ai_uint32 length();
     char data()[Assimp.MAXLEN];
 }
  • Field Details

    • SIZEOF

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

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

      public static final int LENGTH
      The struct member offsets.
    • DATA

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

    • AIString

      public AIString(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 Details

    • sizeof

      public int sizeof()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<AIString>
    • length

      public int length()
      Binary length of the string excluding the terminal 0.
    • data

      public ByteBuffer data()
      String buffer.
    • dataString

      public String dataString()
      String buffer.
    • data

      public AIString data(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()
      Returns a new AIString instance allocated with BufferUtils.
    • 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(int capacity)
      Returns a new AIString.Buffer instance allocated with BufferUtils.
      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.
    • mallocStack

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

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

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

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

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

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

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

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

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

      public static AIString calloc(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
    • malloc

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

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

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

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

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

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

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