A buffer of bytes extending from the ByteStream class that is used for holding bytes read in from the connection
The current position to use when appending data to the buffer
The current position in the buffer for reading data
explicit DataBuffer( |
| ) |
Constructor to create a DataBuffer object
size uint32 | The start and final size of the DataBuffer |
explicit DataBuffer( |
| ) |
explicit DataBuffer( |
| ) |
Constructor to create a DataBuffer given an existing ByteStream
data const ByteStream& | a ByteStream containing existing data |
Default destructor for the DataBuffer object
Gets the next byte from the buffer without moving the read position
The next byte in the buffer, based on its current position
std::out_of_range: The index requested is out of range
Reads the next 1-byte signed integer from the buffer
The next int8 in the buffer, based on its current position
std::out_of_range: The index requested is out of range
Reads the next 1-byte unsigned integer from the buffer
The next uint8 in the buffer, based on its current position
std::out_of_range: The index requested is out of range
Reads the next 2-byte signed integer from the buffer
The next int16 in the buffer, based on its current position
std::out_of_range: The index requested is out of range
Reads the next 2-byte unsigned integer from the buffer
The next uint16 in the buffer, based on its current position
std::out_of_range: The index requested is out of range
Reads the next 4-byte unsigned integer from the buffer
The next uint32 in the buffer, based on its current position
std::out_of_range: The index requested is out of range
Reads the next 4-byte float from the buffer
The next float in the buffer, based on its current position
std::out_of_range: The index requested is out of range
Reads the next 8-byte double from the buffer
The next double in the buffer, based on its current position
std::out_of_range: The index requested is out of range
std::string read_string( |
| ) |
Reads a string of the specified length from the buffer
length std::size_t | The length (number of characters) of the string to read |
The string of the specified length, starting from the current position in the buffer
std::out_of_range: The index + length requested is out of range
Gets the amount of bytes in the DataBuffer
The amount of bytes in the DataBuffer
Gets the remaining bytes available to read (append position | read position) |
The remaining number of bytes available to read
Gets the append position of the buffer.
The append position of the buffer.
Gets the read position of the buffer.
The read position of the buffer.
Gets whether or not there are more bytes to be read in the DataBuffer
true if m_moreToRead is true, false otherwise
Copies any unparsed data in the DataBuffer to the front of the buffer. Also resets the readPosition and moves the appendPosition to immediately after the data that was moved.
The number of bytes that were shifted.
Creates a BufferWriter object based on this DataBuffer.
A BufferWriter object used to add data to this DataBuffer
Resets the append and read positions in the buffer back to 0.