Class SPVText

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class SPVText extends Struct<SPVText> implements NativeResource

 struct spv_text_t {
     char const * str;
     size_t length;
 }
  • Field Details

    • SIZEOF

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

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

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

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

    • SPVText

      public SPVText(ByteBuffer container)
      Creates a SPVText 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<SPVText>
    • str

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

      public String strString()
      Returns:
      the null-terminated string pointed to by the str field.
    • length

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      public static ByteBuffer nstr(long struct)
      Unsafe version of str().
    • nstrString

      public static String nstrString(long struct)
      Unsafe version of strString().
    • nlength

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