read
Buffer::read
Reads content from a Buffer.
Declaration
size_t read(std::byte* dataToRead, size_t size);
Parameters
Name |
Type |
Description |
---|---|---|
dataToRead |
A pointer to get the data read from the Buffer. |
|
size |
size_t |
The amount of data to read from the Buffer. |
Returns
The actual size of the data read from the Buffer.
This actual data size is calculated this way:
\(actualSize = \begin{cases} getSize() - cursor, & (cursor + size) > getSize() \\ size, & otherwise \end{cases}\)
The cursor is then advanced by this actual size, but its position can be set using setCursorPosition.