Class ktxStream

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class ktxStream extends Struct<ktxStream> implements NativeResource

 struct ktxStream {
     {@link ktxStream_readI ktxStream_read} read;
     {@link ktxStream_skipI ktxStream_skip} skip;
     {@link ktxStream_writeI ktxStream_write} write;
     {@link ktxStream_getposI ktxStream_getpos} getpos;
     {@link ktxStream_setposI ktxStream_setpos} setpos;
     {@link ktxStream_getsizeI ktxStream_getsize} getsize;
     {@link ktxStream_destructI ktxStream_destruct} destruct;
     enum streamType type;
     union {
         FILE * file;
         ktxMem * mem;
         struct {
             void * address;
             void * allocatorAddress;
             ktx_size_t size;
         } custom_ptr;
     } data;
     ktx_off_t readpos;
     ktx_bool_t closeOnDestruct;
 }
  • Field Details

    • SIZEOF

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

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

      public static final int READ
      The struct member offsets.
    • SKIP

      public static final int SKIP
      The struct member offsets.
    • WRITE

      public static final int WRITE
      The struct member offsets.
    • GETPOS

      public static final int GETPOS
      The struct member offsets.
    • SETPOS

      public static final int SETPOS
      The struct member offsets.
    • GETSIZE

      public static final int GETSIZE
      The struct member offsets.
    • DESTRUCT

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

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

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

      public static final int DATA_FILE
      The struct member offsets.
    • DATA_MEM

      public static final int DATA_MEM
      The struct member offsets.
    • DATA_CUSTOM_PTR

      public static final int DATA_CUSTOM_PTR
      The struct member offsets.
    • DATA_CUSTOM_PTR_ADDRESS

      public static final int DATA_CUSTOM_PTR_ADDRESS
      The struct member offsets.
    • DATA_CUSTOM_PTR_ALLOCATORADDRESS

      public static final int DATA_CUSTOM_PTR_ALLOCATORADDRESS
      The struct member offsets.
    • DATA_CUSTOM_PTR_SIZE

      public static final int DATA_CUSTOM_PTR_SIZE
      The struct member offsets.
    • READPOS

      public static final int READPOS
      The struct member offsets.
    • CLOSEONDESTRUCT

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

    • ktxStream

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

      public ktxStream_read read()
      Returns:
      the value of the read field.
    • skip

      public ktxStream_skip skip()
      Returns:
      the value of the skip field.
    • write

      public ktxStream_write write()
      Returns:
      the value of the write field.
    • getpos

      public ktxStream_getpos getpos()
      Returns:
      the value of the getpos field.
    • setpos

      public ktxStream_setpos setpos()
      Returns:
      the value of the setpos field.
    • getsize

      public ktxStream_getsize getsize()
      Returns:
      the value of the getsize field.
    • destruct

      public ktxStream_destruct destruct()
      Returns:
      the value of the destruct field.
    • type

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

      public long data_file()
      Returns:
      the value of the data.file field.
    • data_mem

      public long data_mem()
      Returns:
      the value of the data.mem field.
    • data_custom_ptr_address

      public ByteBuffer data_custom_ptr_address(int capacity)
      Returns:
      a ByteBuffer view of the data pointed to by the data.custom_ptr.address field.
    • data_custom_ptr_allocatorAddress

      public long data_custom_ptr_allocatorAddress()
      Returns:
      the value of the data.custom_ptr.allocatorAddress field.
    • data_custom_ptr_size

      public long data_custom_ptr_size()
      Returns:
      the value of the data.custom_ptr.size field.
    • readpos

      public long readpos()
      Returns:
      the value of the readpos field.
    • closeOnDestruct

      public boolean closeOnDestruct()
      Returns:
      the value of the closeOnDestruct field.
    • read

      public ktxStream read(ktxStream_readI value)
      Sets the specified value to the read field.
    • skip

      public ktxStream skip(ktxStream_skipI value)
      Sets the specified value to the skip field.
    • write

      public ktxStream write(ktxStream_writeI value)
      Sets the specified value to the write field.
    • getpos

      public ktxStream getpos(ktxStream_getposI value)
      Sets the specified value to the getpos field.
    • setpos

      public ktxStream setpos(ktxStream_setposI value)
      Sets the specified value to the setpos field.
    • getsize

      public ktxStream getsize(ktxStream_getsizeI value)
      Sets the specified value to the getsize field.
    • destruct

      public ktxStream destruct(ktxStream_destructI value)
      Sets the specified value to the destruct field.
    • type

      public ktxStream type(int value)
      Sets the specified value to the type field.
    • data_file

      public ktxStream data_file(long value)
      Sets the specified value to the file field.
    • data_mem

      public ktxStream data_mem(long value)
      Sets the specified value to the mem field.
    • data_custom_ptr_address

      public ktxStream data_custom_ptr_address(ByteBuffer value)
      Sets the address of the specified ByteBuffer to the address field.
    • data_custom_ptr_allocatorAddress

      public ktxStream data_custom_ptr_allocatorAddress(long value)
      Sets the specified value to the allocatorAddress field.
    • data_custom_ptr_size

      public ktxStream data_custom_ptr_size(long value)
      Sets the specified value to the size field.
    • readpos

      public ktxStream readpos(long value)
      Sets the specified value to the readpos field.
    • closeOnDestruct

      public ktxStream closeOnDestruct(boolean value)
      Sets the specified value to the closeOnDestruct field.
    • set

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      public static ktxStream_read nread(long struct)
      Unsafe version of read().
    • nskip

      public static ktxStream_skip nskip(long struct)
      Unsafe version of skip().
    • nwrite

      public static ktxStream_write nwrite(long struct)
      Unsafe version of write().
    • ngetpos

      public static ktxStream_getpos ngetpos(long struct)
      Unsafe version of getpos().
    • nsetpos

      public static ktxStream_setpos nsetpos(long struct)
      Unsafe version of setpos().
    • ngetsize

      public static ktxStream_getsize ngetsize(long struct)
      Unsafe version of getsize().
    • ndestruct

      public static ktxStream_destruct ndestruct(long struct)
      Unsafe version of destruct().
    • ntype

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

      public static long ndata_file(long struct)
      Unsafe version of data_file().
    • ndata_mem

      public static long ndata_mem(long struct)
      Unsafe version of data_mem().
    • ndata_custom_ptr_address

      public static ByteBuffer ndata_custom_ptr_address(long struct, int capacity)
      Unsafe version of data_custom_ptr_address.
    • ndata_custom_ptr_allocatorAddress

      public static long ndata_custom_ptr_allocatorAddress(long struct)
    • ndata_custom_ptr_size

      public static long ndata_custom_ptr_size(long struct)
      Unsafe version of data_custom_ptr_size().
    • nreadpos

      public static long nreadpos(long struct)
      Unsafe version of readpos().
    • ncloseOnDestruct

      public static boolean ncloseOnDestruct(long struct)
      Unsafe version of closeOnDestruct().
    • nread

      public static void nread(long struct, ktxStream_readI value)
      Unsafe version of read.
    • nskip

      public static void nskip(long struct, ktxStream_skipI value)
      Unsafe version of skip.
    • nwrite

      public static void nwrite(long struct, ktxStream_writeI value)
      Unsafe version of write.
    • ngetpos

      public static void ngetpos(long struct, ktxStream_getposI value)
      Unsafe version of getpos.
    • nsetpos

      public static void nsetpos(long struct, ktxStream_setposI value)
      Unsafe version of setpos.
    • ngetsize

      public static void ngetsize(long struct, ktxStream_getsizeI value)
      Unsafe version of getsize.
    • ndestruct

      public static void ndestruct(long struct, ktxStream_destructI value)
      Unsafe version of destruct.
    • ntype

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

      public static void ndata_file(long struct, long value)
      Unsafe version of data_file.
    • ndata_mem

      public static void ndata_mem(long struct, long value)
      Unsafe version of data_mem.
    • ndata_custom_ptr_address

      public static void ndata_custom_ptr_address(long struct, ByteBuffer value)
      Unsafe version of data_custom_ptr_address.
    • ndata_custom_ptr_allocatorAddress

      public static void ndata_custom_ptr_allocatorAddress(long struct, long value)
    • ndata_custom_ptr_size

      public static void ndata_custom_ptr_size(long struct, long value)
      Sets the specified value to the size field of the specified struct.
    • nreadpos

      public static void nreadpos(long struct, long value)
      Unsafe version of readpos.
    • ncloseOnDestruct

      public static void ncloseOnDestruct(long struct, boolean value)
      Unsafe version of closeOnDestruct.
    • validate

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