tbytebuffer.md 6.2 KB


id: tbytebuffer title: TByteBuffer

sidebar_label: TByteBuffer

A TBuffer for bytes.

Methods

Method Order:EByteOrder()

Gets the byte order used by the TByteBuffer when doing Byte conversions.


Method Order:TByteBuffer(byteOrder:EByteOrder)

Sets the byte order to use by the TByteBuffer when doing Byte conversions.


Method Get:Byte() Abstract

Returns the Byte at the current position, and increments the position by 1.


Method GetShort:Short() Abstract

Returns the Short at the current position, and increments the position by 2.


Method GetInt:Int() Abstract

Returns the Int at the current position, and increments the position by 4.


Method GetUInt:UInt() Abstract

Returns the UInt at the current position, and increments the position by 4.


Method GetLong:Long() Abstract

Returns the Long at the current position, and increments the position by 8.


Method GetULong:ULong() Abstract

Returns the ULong at the current position, and increments the position by 8.


Method GetSizeT:Size_T() Abstract

Returns the Size_T at the current position, and increments the position by 8 (64-bit) or 4 (32-bit).


Method GetFloat:Float() Abstract

Returns the Float at the current position, and increments the position by 4.


Method GetDouble:Double() Abstract

Returns the Double at the current position, and increments the position by 8.


Method GetBytes(dst:Byte Ptr, length:UInt) Abstract

Copies length bytes into dst at the curent position, and increments the position by length.


Method Put:TByteBuffer(value:Byte) Abstract

Writes the specified Byte to the current position and increments the position by 1.


Method PutShort:TByteBuffer(value:Short) Abstract

Writes the specified Short to the current position and increments the position by 2.


Method PutInt:TByteBuffer(value:Int) Abstract

Writes the specified Int to the current position and increments the position by 4.


Method PutUInt:TByteBuffer(value:UInt) Abstract

Writes the specified UInt to the current position and increments the position by 4.


Method PutLong:TByteBuffer(value:Long) Abstract

Writes the specified Long to the current position and increments the position by 8.


Method PutULong:TByteBuffer(value:ULong) Abstract

Writes the specified ULong to the current position and increments the position by 8.


Method PutSizeT:TByteBuffer(value:Size_T) Abstract

Writes the specified Size_T to the current position and increments the position by 8 (64-bit) or 4 (32-bit).


Method PutFloat:TByteBuffer(value:Float) Abstract

Writes the specified Float to the current position and increments the position by 4.


Method PutDouble:TByteBuffer(value:Double) Abstract

Writes the specified Double to the current position and increments the position by 8.


Method PutBytes:TByteBuffer(bytes:Byte Ptr, length:UInt) Abstract

Writes the specified number of bytes to the current position.


Method Slice:TByteBuffer() Abstract

Returns a sliced TByteBuffer that shares its content with this one.

The new buffer's position, limit, and mark are independent of this buffer.


Method Slice:TByteBuffer(length:Int) Abstract

Returns a sliced TByteBuffer that shares its content with this one.

The new buffer's position, limit, and mark are independent of this buffer.


Method Slice:TByteBuffer(start:Int, length:Int) Abstract

Returns a sliced TByteBuffer that shares its content with this one, starting at the specified start position.

The new buffer's position, limit, and mark are independent of this buffer.


Method SliceFrom:TByteBuffer(start:Int) Abstract

Returns a sliced TByteBuffer that shares its content with this one, starting at the specified start position.

The new buffer's position, limit, and mark are independent of this buffer.


Method Duplicate:TByteBuffer() Abstract

Creates a duplicate TByteBuffer that shares its content with this one.


Method Compact:TByteBuffer() Abstract

Compacts this TByteBuffer.


Method AsReadOnly:TByteBuffer() Abstract

Returns a read-only view of this buffer.

The returned buffer shares content with this buffer but does not allow modification. The position, limit, mark, and byte order are preserved.


Functions

Function Allocate:TByteBuffer(size:Int)

Allocates a new TByteBuffer of the specific size number of bytes.


Function Wrap:TByteBuffer(data:Byte[])

Creates a new TByteBuffer by wrapping the provided Byte array.


Function Wrap:TByteBuffer(data:Byte Ptr, size:Int)

Creates a new TByteBuffer by wrapping the provided Byte Ptr.

Note that the Byte Ptr is expected to remain valid throughout the use of the TByteBuffer. Freeing the associated memory early may result in undefined behaviour.