Package org.lwjgl.util.ktx
Class ktxStream
java.lang.Object
org.lwjgl.system.Pointer.Default
org.lwjgl.system.Struct<ktxStream>
org.lwjgl.util.ktx.ktxStream
- All Implemented Interfaces:
AutoCloseable,org.lwjgl.system.NativeResource,org.lwjgl.system.Pointer
public class ktxStream
extends org.lwjgl.system.Struct<ktxStream>
implements org.lwjgl.system.NativeResource
Interface of
ktxStream.
Layout
struct ktxStream {
ktxStream_read read();
ktxStream_skip skip();
ktxStream_write write();
ktxStream_getpos getpos();
ktxStream_setpos setpos();
ktxStream_getsize getsize();
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();
}-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.lwjgl.system.Struct
org.lwjgl.system.Struct.StructValidationNested classes/interfaces inherited from interface org.lwjgl.system.Pointer
org.lwjgl.system.Pointer.Default -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe struct alignment in bytes.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct size in bytes.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.Fields inherited from interface org.lwjgl.system.Pointer
BITS32, BITS64, CLONG_SHIFT, CLONG_SIZE, POINTER_SHIFT, POINTER_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionktxStream(ByteBuffer container) Creates aktxStreaminstance at the current position of the specifiedByteBuffercontainer. -
Method Summary
Modifier and TypeMethodDescriptionstatic ktxStreamcalloc()Returns a newktxStreaminstance allocated withmemCalloc.static ktxStream.Buffercalloc(int capacity) Returns a newktxStream.Bufferinstance allocated withmemCalloc.static ktxStream.Buffercalloc(int capacity, org.lwjgl.system.MemoryStack stack) Returns a newktxStream.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static ktxStreamcalloc(org.lwjgl.system.MemoryStack stack) Returns a newktxStreaminstance allocated on the specifiedMemoryStackand initializes all its bits to zero.booleancloseFILE*or dispose of memory on destructcloseOnDestruct(boolean value) Sets the specified value to thecloseOnDestruct()field.static ktxStreamcreate()Returns a newktxStreaminstance allocated withBufferUtils.static ktxStream.Buffercreate(int capacity) Returns a newktxStream.Bufferinstance allocated withBufferUtils.static ktxStreamcreate(long address) Returns a newktxStreaminstance for the specified memory address.static ktxStream.Buffercreate(long address, int capacity) Create aktxStream.Bufferinstance at the specified memory.static @Nullable ktxStreamcreateSafe(long address) static @Nullable ktxStream.BuffercreateSafe(long address, int capacity) data_custom_ptr_address(int capacity) Sets the address of the specifiedByteBufferto thedata_custom_ptr_address(int)field.longpointer to a memory allocatordata_custom_ptr_allocatorAddress(long value) Sets the specified value to thedata_custom_ptr_allocatorAddress()field.longsize of the datadata_custom_ptr_size(long value) Sets the specified value to thedata_custom_ptr_size()field.longastdioFILEpointer for aktxFileStreamdata_file(long value) Sets the specified value to thedata_file()field.longdata_mem()a pointer to aktxMemstruct for aktxMemStreamdata_mem(long value) Sets the specified value to thedata_mem()field.destruct()destruct the streamdestruct(ktxStream_destructI value) Sets the specified value to thedestruct()field.getpos()pointer to function for getting current position in streamgetpos(ktxStream_getposI value) Sets the specified value to thegetpos()field.getsize()pointer to function for querying sizegetsize(ktxStream_getsizeI value) Sets the specified value to thegetsize()field.static ktxStreammalloc()Returns a newktxStreaminstance allocated withmemAlloc.static ktxStream.Buffermalloc(int capacity) Returns a newktxStream.Bufferinstance allocated withmemAlloc.static ktxStream.Buffermalloc(int capacity, org.lwjgl.system.MemoryStack stack) Returns a newktxStream.Bufferinstance allocated on the specifiedMemoryStack.static ktxStreammalloc(org.lwjgl.system.MemoryStack stack) Returns a newktxStreaminstance allocated on the specifiedMemoryStack.static booleanncloseOnDestruct(long struct) Unsafe version ofcloseOnDestruct().static voidncloseOnDestruct(long struct, boolean value) Unsafe version ofcloseOnDestruct.static ByteBufferndata_custom_ptr_address(long struct, int capacity) Unsafe version ofdata_custom_ptr_address.static voidndata_custom_ptr_address(long struct, ByteBuffer value) Unsafe version ofdata_custom_ptr_address.static longndata_custom_ptr_allocatorAddress(long struct) Unsafe version ofdata_custom_ptr_allocatorAddress().static voidndata_custom_ptr_allocatorAddress(long struct, long value) Unsafe version ofdata_custom_ptr_allocatorAddress.static longndata_custom_ptr_size(long struct) Unsafe version ofdata_custom_ptr_size().static voidndata_custom_ptr_size(long struct, long value) Sets the specified value to thesizefield of the specifiedstruct.static longndata_file(long struct) Unsafe version ofdata_file().static voidndata_file(long struct, long value) Unsafe version ofdata_file.static longndata_mem(long struct) Unsafe version ofdata_mem().static voidndata_mem(long struct, long value) Unsafe version ofdata_mem.static ktxStream_destructndestruct(long struct) Unsafe version ofdestruct().static voidndestruct(long struct, ktxStream_destructI value) Unsafe version ofdestruct.static ktxStream_getposngetpos(long struct) Unsafe version ofgetpos().static voidngetpos(long struct, ktxStream_getposI value) Unsafe version ofgetpos.static ktxStream_getsizengetsize(long struct) Unsafe version ofgetsize().static voidngetsize(long struct, ktxStream_getsizeI value) Unsafe version ofgetsize.static ktxStream_readnread(long struct) Unsafe version ofread().static voidnread(long struct, ktxStream_readI value) Unsafe version ofread.static longnreadpos(long struct) Unsafe version ofreadpos().static voidnreadpos(long struct, long value) Unsafe version ofreadpos.static ktxStream_setposnsetpos(long struct) Unsafe version ofsetpos().static voidnsetpos(long struct, ktxStream_setposI value) Unsafe version ofsetpos.static ktxStream_skipnskip(long struct) Unsafe version ofskip().static voidnskip(long struct, ktxStream_skipI value) Unsafe version ofskip.static intntype(long struct) Unsafe version oftype().static voidntype(long struct, int value) Unsafe version oftype.static ktxStream_writenwrite(long struct) Unsafe version ofwrite().static voidnwrite(long struct, ktxStream_writeI value) Unsafe version ofwrite.read()pointer to function for reading bytesread(ktxStream_readI value) Sets the specified value to theread()field.longreadpos()used byFileStreamforstdinreadpos(long value) Sets the specified value to thereadpos()field.Copies the specified struct data to this struct.setpos()pointer to function for setting current position in streamsetpos(ktxStream_setposI value) Sets the specified value to thesetpos()field.intsizeof()skip()pointer to function for skipping bytesskip(ktxStream_skipI value) Sets the specified value to theskip()field.inttype()type(int value) Sets the specified value to thetypefield.static voidvalidate(long struct) Validates pointer members that should not beNULL.write()pointer to function for writing byteswrite(ktxStream_writeI value) Sets the specified value to thewrite()field.Methods inherited from class org.lwjgl.system.Struct
clear, free, isNull, validate, validateMethods inherited from class org.lwjgl.system.Pointer.Default
address, equals, hashCode, toStringMethods inherited from interface org.lwjgl.system.NativeResource
close, free
-
Field Details
-
SIZEOF
public static final int SIZEOFThe struct size in bytes. -
ALIGNOF
public static final int ALIGNOFThe struct alignment in bytes. -
READ
public static final int READThe struct member offsets. -
SKIP
public static final int SKIPThe struct member offsets. -
WRITE
public static final int WRITEThe struct member offsets. -
GETPOS
public static final int GETPOSThe struct member offsets. -
SETPOS
public static final int SETPOSThe struct member offsets. -
GETSIZE
public static final int GETSIZEThe struct member offsets. -
DESTRUCT
public static final int DESTRUCTThe struct member offsets. -
TYPE
public static final int TYPEThe struct member offsets. -
DATA
public static final int DATAThe struct member offsets. -
DATA_FILE
public static final int DATA_FILEThe struct member offsets. -
DATA_MEM
public static final int DATA_MEMThe struct member offsets. -
DATA_CUSTOM_PTR
public static final int DATA_CUSTOM_PTRThe struct member offsets. -
DATA_CUSTOM_PTR_ADDRESS
public static final int DATA_CUSTOM_PTR_ADDRESSThe struct member offsets. -
DATA_CUSTOM_PTR_ALLOCATORADDRESS
public static final int DATA_CUSTOM_PTR_ALLOCATORADDRESSThe struct member offsets. -
DATA_CUSTOM_PTR_SIZE
public static final int DATA_CUSTOM_PTR_SIZEThe struct member offsets. -
READPOS
public static final int READPOSThe struct member offsets. -
CLOSEONDESTRUCT
public static final int CLOSEONDESTRUCTThe struct member offsets.
-
-
Constructor Details
-
ktxStream
Creates aktxStreaminstance at the current position of the specifiedByteBuffercontainer. 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()- Specified by:
sizeofin classorg.lwjgl.system.Struct<ktxStream>
-
read
pointer to function for reading bytes -
skip
pointer to function for skipping bytes -
write
pointer to function for writing bytes -
getpos
pointer to function for getting current position in stream -
setpos
pointer to function for setting current position in stream -
getsize
pointer to function for querying size -
destruct
destruct the stream -
type
public int type()- Returns:
- the value of the
typefield.
-
data_file
public long data_file()astdioFILEpointer for aktxFileStream -
data_mem
public long data_mem()a pointer to aktxMemstruct for aktxMemStream -
data_custom_ptr_address
- Parameters:
capacity- the number of elements in the returned buffer- Returns:
- pointer to the data
-
data_custom_ptr_allocatorAddress
public long data_custom_ptr_allocatorAddress()pointer to a memory allocator -
data_custom_ptr_size
public long data_custom_ptr_size()size of the data -
readpos
public long readpos()used byFileStreamforstdin -
closeOnDestruct
public boolean closeOnDestruct()closeFILE*or dispose of memory on destruct -
read
Sets the specified value to theread()field. -
skip
Sets the specified value to theskip()field. -
write
Sets the specified value to thewrite()field. -
getpos
Sets the specified value to thegetpos()field. -
setpos
Sets the specified value to thesetpos()field. -
getsize
Sets the specified value to thegetsize()field. -
destruct
Sets the specified value to thedestruct()field. -
type
Sets the specified value to thetypefield. -
data_file
Sets the specified value to thedata_file()field. -
data_mem
Sets the specified value to thedata_mem()field. -
data_custom_ptr_address
Sets the address of the specifiedByteBufferto thedata_custom_ptr_address(int)field. -
data_custom_ptr_allocatorAddress
Sets the specified value to thedata_custom_ptr_allocatorAddress()field. -
data_custom_ptr_size
Sets the specified value to thedata_custom_ptr_size()field. -
readpos
Sets the specified value to thereadpos()field. -
closeOnDestruct
Sets the specified value to thecloseOnDestruct()field. -
set
Copies the specified struct data to this struct.- Parameters:
src- the source struct- Returns:
- this struct
-
malloc
Returns a newktxStreaminstance allocated withmemAlloc. The instance must be explicitly freed. -
calloc
Returns a newktxStreaminstance allocated withmemCalloc. The instance must be explicitly freed. -
create
Returns a newktxStreaminstance allocated withBufferUtils. -
create
Returns a newktxStreaminstance for the specified memory address. -
createSafe
-
malloc
Returns a newktxStream.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
Returns a newktxStream.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
Returns a newktxStream.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
Create aktxStream.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
createSafe
-
malloc
Returns a newktxStreaminstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
Returns a newktxStreaminstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
malloc
Returns a newktxStream.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
calloc
Returns a newktxStream.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
nread
Unsafe version ofread(). -
nskip
Unsafe version ofskip(). -
nwrite
Unsafe version ofwrite(). -
ngetpos
Unsafe version ofgetpos(). -
nsetpos
Unsafe version ofsetpos(). -
ngetsize
Unsafe version ofgetsize(). -
ndestruct
Unsafe version ofdestruct(). -
ntype
public static int ntype(long struct) Unsafe version oftype(). -
ndata_file
public static long ndata_file(long struct) Unsafe version ofdata_file(). -
ndata_mem
public static long ndata_mem(long struct) Unsafe version ofdata_mem(). -
ndata_custom_ptr_address
Unsafe version ofdata_custom_ptr_address. -
ndata_custom_ptr_allocatorAddress
public static long ndata_custom_ptr_allocatorAddress(long struct) Unsafe version ofdata_custom_ptr_allocatorAddress(). -
ndata_custom_ptr_size
public static long ndata_custom_ptr_size(long struct) Unsafe version ofdata_custom_ptr_size(). -
nreadpos
public static long nreadpos(long struct) Unsafe version ofreadpos(). -
ncloseOnDestruct
public static boolean ncloseOnDestruct(long struct) Unsafe version ofcloseOnDestruct(). -
nread
Unsafe version ofread. -
nskip
Unsafe version ofskip. -
nwrite
Unsafe version ofwrite. -
ngetpos
Unsafe version ofgetpos. -
nsetpos
Unsafe version ofsetpos. -
ngetsize
Unsafe version ofgetsize. -
ndestruct
Unsafe version ofdestruct. -
ntype
public static void ntype(long struct, int value) Unsafe version oftype. -
ndata_file
public static void ndata_file(long struct, long value) Unsafe version ofdata_file. -
ndata_mem
public static void ndata_mem(long struct, long value) Unsafe version ofdata_mem. -
ndata_custom_ptr_address
Unsafe version ofdata_custom_ptr_address. -
ndata_custom_ptr_allocatorAddress
public static void ndata_custom_ptr_allocatorAddress(long struct, long value) Unsafe version ofdata_custom_ptr_allocatorAddress. -
ndata_custom_ptr_size
public static void ndata_custom_ptr_size(long struct, long value) Sets the specified value to thesizefield of the specifiedstruct. -
nreadpos
public static void nreadpos(long struct, long value) Unsafe version ofreadpos. -
ncloseOnDestruct
public static void ncloseOnDestruct(long struct, boolean value) Unsafe version ofcloseOnDestruct. -
validate
public static void validate(long struct) Validates pointer members that should not beNULL.- Parameters:
struct- the struct to validate
-