Class FT_Data

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class FT_Data extends Struct<FT_Data> implements NativeResource

 struct FT_Data {
     FT_Byte const * pointer;
     FT_UInt 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.
    • POINTER

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

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

    • FT_Data

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

      public ByteBuffer pointer()
      Returns:
      a ByteBuffer view of the data pointed to by the pointer field.
    • length

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

      public FT_Data pointer(ByteBuffer value)
      Sets the address of the specified ByteBuffer to the pointer field.
    • set

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      public static ByteBuffer npointer(long struct)
      Unsafe version of pointer.
    • nlength

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

      public static void npointer(long struct, ByteBuffer value)
      Unsafe version of pointer.
    • nlength

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

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