39 bool Write(
const void * a_Bytes,
size_t a_Count);
94 a_Value =
static_cast<T
>(v);
120 bool ReadBuf(
void * a_Buffer,
size_t a_Count);
123 bool WriteBuf(
const void * a_Buffer,
size_t a_Count);
126 bool WriteBuf(
size_t a_Count,
unsigned char a_Value);
unsigned long long UInt64
std::basic_string< std::byte > ContiguousByteBuffer
An object that can store incoming bytes and lets its clients read the bytes sequentially The bytes ar...
bool ReadBEUInt16(UInt16 &a_Value)
size_t GetUsedSpace(void) const
Returns the number of bytes that are currently in the ringbuffer.
bool WriteXYZPosition64(Int32 a_BlockX, Int32 a_BlockY, Int32 a_BlockZ)
bool SkipRead(size_t a_Count)
Skips reading by a_Count bytes; returns false if not enough bytes in the ringbuffer.
bool ReadBEUInt8(UInt8 &a_Value)
bool CanReadBytes(size_t a_Count) const
Returns true if the specified amount of bytes are available for reading.
bool WriteVarInt64(UInt64 a_Value)
static bool CanBEInt16Represent(int a_Value)
Returns if the given value can fit in a protocol big-endian 16 bit integer.
void CommitRead(void)
Removes the bytes that have been read from the ringbuffer.
bool ReadBEUInt64(UInt64 &a_Value)
bool ReadBuf(void *a_Buffer, size_t a_Count)
Reads a_Count bytes into a_Buffer; returns true if successful.
bool ReadXZYPosition64(int &a_BlockX, int &a_BlockY, int &a_BlockZ)
void ReadAll(ContiguousByteBuffer &a_Data)
Reads all available data into a_Data.
bool ReadVarInt64(UInt64 &a_Value)
void CheckValid(void) const
Checks if the internal state is valid (read and write positions in the correct bounds) using ASSERTs.
bool WriteLEInt32(Int32 a_Value)
bool WriteXZYPosition64(Int32 a_BlockX, Int32 a_BlockY, Int32 a_BlockZ)
bool ReadUUID(cUUID &a_Value)
bool ReadBEFloat(float &a_Value)
void AdvanceReadPos(size_t a_Count)
Advances the m_ReadPos by a_Count bytes.
bool ReadLEInt(int &a_Value)
bool ReadBEInt64(Int64 &a_Value)
bool WriteBEUInt32(UInt32 a_Value)
bool ReadToByteBuffer(cByteBuffer &a_Dst, size_t a_NumBytes)
Reads the specified number of bytes and writes it into the destinatio bytebuffer.
size_t GetFreeSpace(void) const
Returns the number of bytes that can be successfully written to the ringbuffer.
bool WriteBEFloat(float a_Value)
size_t GetReadableSpace(void) const
Returns the number of bytes that are currently available for reading (may be less than UsedSpace due ...
bool WriteBEInt32(Int32 a_Value)
bool ReadBool(bool &a_Value)
bool WriteBEInt64(Int64 a_Value)
bool ReadVarInt32(UInt32 &a_Value)
bool WriteBEInt16(Int16 a_Value)
bool WriteBEUInt64(UInt64 a_Value)
bool CanWriteBytes(size_t a_Count) const
Returns true if the specified amount of bytes are available for writing.
bool ReadVarInt(T &a_Value)
Reads VarInt, assigns it to anything that can be assigned from an UInt64 (unsigned short,...
bool WriteBuf(const void *a_Buffer, size_t a_Count)
Writes a_Count bytes into a_Buffer; returns true if successful.
std::thread::id m_ThreadID
The ID of the thread currently accessing the object.
bool ReadXYZPosition64(int &a_BlockX, int &a_BlockY, int &a_BlockZ)
bool WriteBool(bool a_Value)
void ReadAgain(ContiguousByteBuffer &a_Out)
Re-reads the data that has been read since the last commit to the current readpos.
size_t GetDataStart(void) const
Returns the current data start index.
bool WriteVarUTF8String(const AString &a_Value)
bool WriteBEInt8(Int8 a_Value)
bool WriteVarInt32(UInt32 a_Value)
static size_t GetVarIntSize(UInt32 a_Value)
Gets the number of bytes that are needed to represent the given VarInt.
bool ReadBEInt8(Int8 &a_Value)
bool ReadVarUTF8String(AString &a_Value)
bool ReadSome(ContiguousByteBuffer &a_String, size_t a_Count)
Reads a_Count bytes into a_String; returns true if successful.
bool ReadBEUInt32(UInt32 &a_Value)
bool ReadBEInt32(Int32 &a_Value)
void ResetRead(void)
Restarts next reading operation at the start of the ringbuffer.
bool Write(const void *a_Bytes, size_t a_Count)
Writes the bytes specified to the ringbuffer.
static bool CanBEInt8Represent(int a_Value)
Returns if the given value can fit in a protocol big-endian 8 bit integer.
bool WriteBEUInt16(UInt16 a_Value)
bool WriteBEUInt8(UInt8 a_Value)
cByteBuffer(size_t a_BufferSize)
bool ReadBEDouble(double &a_Value)
bool WriteBEDouble(double a_Value)
bool ReadBEInt16(Int16 &a_Value)