byteme
C++ wrappers for buffered inputs
|
Read chunks of bytes from a raw buffer. More...
#include <ChunkedBufferReader.hpp>
Public Member Functions | |
ChunkedBufferReader (const unsigned char *buffer, std::size_t length, std::size_t chunk_size) | |
bool | load () |
const unsigned char * | buffer () const |
std::size_t | available () const |
![]() |
Read chunks of bytes from a raw buffer.
This is basically the same as RawBufferReader
except that chunks of bytes are returned on every load()
call. It is primarily intended for use in tests of byteme callers, to ensure that downstream algorithms behave correctly with respect to chunked reads.
|
inline |
[in] | buffer | Pointer to an array of bytes, usually containing text. |
length | Length of the buffer. | |
chunk_size | Size of each chunk in bytes. |
|
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
.
buffer()
. Implements byteme::Reader.
|
inlinevirtual |
This method should only be called after load()
has been called and returns true
.
available()
. Implements byteme::Reader.
|
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.
false
, it can be assumed that the end of the source was reached. Implements byteme::Reader.