#include </opt/build/repo/nap/utility/src/utility/memorystream.h>
|
| MemoryStream (const uint8_t *buffer, uint32_t length) |
|
bool | isDone () const |
|
bool | hasAvailable (uint32_t size) |
|
void | read (void *data, uint32_t length) |
|
template<class T > |
void | read (T &data) |
|
template<class T > |
const T | read () |
|
void | readString (std::string &string) |
|
A MemoryStream allows you to read data from a memory buffer
◆ MemoryStream()
Constructor
- Parameters
-
buffer | The buffer to read from |
length | The length of the buffer we're reading from |
◆ hasAvailable()
bool hasAvailable |
( |
uint32_t |
size | ) |
|
Checks whether the specified amount of bytes is available for reading
- Parameters
-
size | The number of bytes desired for reading |
- Returns
- True if the specified number of bytes can be read, false if not
◆ isDone()
Checks whether all data in this stream has been read
- Returns
- True if all data has been read, false if not
◆ read() [1/3]
Helper function to read a primitive of type T from the stream (returns by value)
- Returns
- The data that was read
◆ read() [2/3]
Helper function to read a primitive of type T from the stream
- Parameters
-
data | The buffer to read to |
◆ read() [3/3]
void read |
( |
void * |
data, |
|
|
uint32_t |
length |
|
) |
| |
Function to read the specified number of bytes from the stream to a buffer
- Parameters
-
data | The buffer to read to |
length | The number of bytes to read |
◆ readString()
void readString |
( |
std::string & |
string | ) |
|
Helper function to read a string from the stream
- Parameters
-
string | The string to read the data to |