Class spng_text

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class spng_text extends Struct<spng_text> implements NativeResource

 struct spng_text {
     char keyword[80];
     int type;
     size_t length;
     char * text;
     uint8_t compression_flag;
     uint8_t compression_method;
     char * language_tag;
     char * translated_keyword;
 }
  • Field Details

    • SIZEOF

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

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

      public static final int KEYWORD
      The struct member offsets.
    • TYPE

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

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

      public static final int TEXT
      The struct member offsets.
    • COMPRESSION_FLAG

      public static final int COMPRESSION_FLAG
      The struct member offsets.
    • COMPRESSION_METHOD

      public static final int COMPRESSION_METHOD
      The struct member offsets.
    • LANGUAGE_TAG

      public static final int LANGUAGE_TAG
      The struct member offsets.
    • TRANSLATED_KEYWORD

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

    • spng_text

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

      public ByteBuffer keyword()
      Returns:
      a ByteBuffer view of the keyword field.
    • keywordString

      public String keywordString()
      Returns:
      the null-terminated string stored in the keyword field.
    • type

      public int type()
      Returns:
      the value of the type field.
    • length

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

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

      public String textString()
      Returns:
      the null-terminated string pointed to by the text field.
    • compression_flag

      public byte compression_flag()
      Returns:
      the value of the compression_flag field.
    • compression_method

      public byte compression_method()
      Returns:
      the value of the compression_method field.
    • language_tag

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

      public String language_tagString()
      Returns:
      the null-terminated string pointed to by the language_tag field.
    • translated_keyword

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

      public String translated_keywordString()
      Returns:
      the null-terminated string pointed to by the translated_keyword field.
    • keyword

      public spng_text keyword(ByteBuffer value)
      Copies the specified encoded string to the keyword field.
    • type

      public spng_text type(int value)
      Sets the specified value to the type field.
    • text

      public spng_text text(ByteBuffer value)
      Sets the address of the specified encoded string to the text field.
    • compression_flag

      public spng_text compression_flag(byte value)
      Sets the specified value to the compression_flag field.
    • compression_method

      public spng_text compression_method(byte value)
      Sets the specified value to the compression_method field.
    • language_tag

      public spng_text language_tag(ByteBuffer value)
      Sets the address of the specified encoded string to the language_tag field.
    • translated_keyword

      public spng_text translated_keyword(ByteBuffer value)
      Sets the address of the specified encoded string to the translated_keyword field.
    • set

      public spng_text set(ByteBuffer keyword, int type, ByteBuffer text, byte compression_flag, byte compression_method, ByteBuffer language_tag, ByteBuffer translated_keyword)
      Initializes this struct with the specified values.
    • set

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      public static ByteBuffer nkeyword(long struct)
      Unsafe version of keyword().
    • nkeywordString

      public static String nkeywordString(long struct)
      Unsafe version of keywordString().
    • ntype

      public static int ntype(long struct)
      Unsafe version of type().
    • nlength

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

      public static ByteBuffer ntext(long struct)
      Unsafe version of text().
    • ntextString

      public static String ntextString(long struct)
      Unsafe version of textString().
    • ncompression_flag

      public static byte ncompression_flag(long struct)
      Unsafe version of compression_flag().
    • ncompression_method

      public static byte ncompression_method(long struct)
      Unsafe version of compression_method().
    • nlanguage_tag

      public static ByteBuffer nlanguage_tag(long struct)
      Unsafe version of language_tag().
    • nlanguage_tagString

      public static String nlanguage_tagString(long struct)
      Unsafe version of language_tagString().
    • ntranslated_keyword

      public static ByteBuffer ntranslated_keyword(long struct)
      Unsafe version of translated_keyword().
    • ntranslated_keywordString

      public static String ntranslated_keywordString(long struct)
      Unsafe version of translated_keywordString().
    • nkeyword

      public static void nkeyword(long struct, ByteBuffer value)
      Unsafe version of keyword.
    • ntype

      public static void ntype(long struct, int value)
      Unsafe version of type.
    • nlength

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

      public static void ntext(long struct, ByteBuffer value)
      Unsafe version of text.
    • ncompression_flag

      public static void ncompression_flag(long struct, byte value)
      Unsafe version of compression_flag.
    • ncompression_method

      public static void ncompression_method(long struct, byte value)
      Unsafe version of compression_method.
    • nlanguage_tag

      public static void nlanguage_tag(long struct, ByteBuffer value)
      Unsafe version of language_tag.
    • ntranslated_keyword

      public static void ntranslated_keyword(long struct, ByteBuffer value)
      Unsafe version of translated_keyword.
    • validate

      public static void validate(long struct)
      Validates pointer members that should not be NULL.
      Parameters:
      struct - the struct to validate