Read bytes from a raw buffer, usually text.
More...
#include <RawBufferReader.hpp>
Read bytes from a raw buffer, usually text.
This is a wrapper around an input buffer, provided for consistency with the other *Reader
classes. We assume that the lifetime of the data in the buffer
pointer exceeds the lifetime of the instance.
◆ RawBufferReader() [1/2]
byteme::RawBufferReader::RawBufferReader |
( |
const unsigned char * | buffer, |
|
|
size_t | length ) |
|
inline |
- Parameters
-
[in] | buffer | Pointer to an array of bytes, usually containing text. |
| length | Length of the buffer. |
◆ RawBufferReader() [2/2]
byteme::RawBufferReader::RawBufferReader |
( |
const char * | buffer, |
|
|
size_t | length ) |
|
inline |
- Parameters
-
[in] | buffer | Pointer to an array of bytes, usually containing text. |
| length | Length of the buffer. |
◆ available()
size_t byteme::RawBufferReader::available |
( |
| ) |
const |
|
inlinevirtual |
This method should only be called after load()
has been called and returns true
. The return value is generally expected to be positive; however, it is possible to return a zero. Note that zero values should not be interpreted as the end of the source, which is strictly only defined by load()
returning false
.
- Returns
- Number of available bytes in
buffer()
.
Implements byteme::Reader.
◆ buffer()
const unsigned char * byteme::RawBufferReader::buffer |
( |
| ) |
const |
|
inlinevirtual |
This method should only be called after load()
has been called and returns true
.
- Returns
- Pointer to the start of an array containing the available bytes. The number of available bytes is provided in
available()
.
Implements byteme::Reader.
◆ load()
bool byteme::RawBufferReader::load |
( |
| ) |
|
|
inlinevirtual |
Read the next chunk of bytes from the input source. To read the entire source, this function should be called repeatedly until false
is returned.
- Returns
- Boolean indicating whether the read was successful. If
false
, it can be assumed that the end of the source was reached.
Implements byteme::Reader.
The documentation for this class was generated from the following file: