A DataReader which reads data from a ByteBuffer.
More...
#include <ByteBufferDataReader.h++>
A DataReader which reads data from a ByteBuffer.
- Author
- Mark Lindner
◆ ByteBufferDataReader()
◆ ~ByteBufferDataReader()
◆ align()
void align |
( |
size_t |
size | ) |
|
|
inherited |
Skip past enough bytes to re-align the data stream at a specified boundary.
When reading, the bytes are simply skipped over; when writing, the bytes are filled with NULs.
- Parameters
-
size | The alignment size. Typical values include 2, 4, or 8. Other values are allowed but are of limited usefulness. |
- Exceptions
-
◆ checkRemaining()
void checkRemaining |
( |
const Context & |
ctx, |
|
|
size_t |
count |
|
) |
| const |
|
protectedinherited |
Check if at least the given number of bytes are available to be read or written.
- Parameters
-
ctx | The context to check. |
count | The number of bytes. |
- Exceptions
-
◆ currentContext() [1/2]
Get a reference to the current context.
◆ currentContext() [2/2]
Get a reference to the current context.
◆ getContextDepth()
uint_t getContextDepth |
( |
| ) |
const |
|
inherited |
Get the current context depth.
◆ getCumulativeOffset()
int64_t getCumulativeOffset |
( |
| ) |
const |
|
inherited |
Get the cumulative reading/writing offset.
This is a sum of the offsets across all contexts.
◆ getEndianness()
Get the byte-endianness in the active context.
◆ getLength()
size_t getLength |
( |
| ) |
const |
|
inherited |
Get the current length for string values.
◆ getLimit()
int64_t getLimit |
( |
| ) |
const |
|
inherited |
◆ getOffset()
int64_t getOffset |
( |
| ) |
const |
|
inherited |
Get the current encoding/decoding offset.
◆ getRemaining()
int64_t getRemaining |
( |
| ) |
const |
|
inherited |
Get the number of bytes between the current offset and the limit, i.e., the number of bytes remaining to be read or written.
◆ isSameEndianness()
bool isSameEndianness |
( |
| ) |
const |
|
protectedinherited |
Test if the endianness of the encoder is the same as the endianness of the host system.
◆ isTopContext()
bool isTopContext |
( |
| ) |
const |
|
inherited |
Determine if the active context is the topmost (and only) context.
◆ operator>>() [1/24]
Read operator.
- Exceptions
-
◆ operator>>() [2/24]
Read operator.
- Exceptions
-
◆ operator>>() [3/24]
Read operator.
- Exceptions
-
◆ operator>>() [4/24]
Read operator.
- Exceptions
-
◆ operator>>() [5/24]
Read operator.
- Exceptions
-
◆ operator>>() [6/24]
Read operator.
- Exceptions
-
◆ operator>>() [7/24]
Read operator.
- Exceptions
-
◆ operator>>() [8/24]
Read operator.
- Exceptions
-
◆ operator>>() [9/24]
Read operator.
- Exceptions
-
◆ operator>>() [10/24]
Read operator.
- Exceptions
-
◆ operator>>() [11/24]
Read operator.
- Exceptions
-
◆ operator>>() [12/24]
Read operator.
- Exceptions
-
◆ operator>>() [13/24]
Read operator.
- Exceptions
-
◆ operator>>() [14/24]
Read operator.
- Exceptions
-
◆ operator>>() [15/24]
Read operator.
- Exceptions
-
◆ operator>>() [16/24]
Read operator.
- Exceptions
-
◆ operator>>() [17/24]
Read operator.
- Exceptions
-
◆ operator>>() [18/24]
Read operator.
- Exceptions
-
◆ operator>>() [19/24]
Read operator.
- Exceptions
-
◆ operator>>() [20/24]
Read operator.
- Exceptions
-
◆ operator>>() [21/24]
Read operator.
- Exceptions
-
◆ operator>>() [22/24]
Read operator.
- Exceptions
-
◆ operator>>() [23/24]
Read operator.
- Exceptions
-
◆ operator>>() [24/24]
Read operator.
- Exceptions
-
◆ popContext()
Pop the active encoder context.
The previous context becomes the active context, and the offset in the current context is incremented by the offset of the popped context.
◆ pushContext()
Push a new encoder context.
◆ read()
size_t read |
( |
byte_t * |
buf, |
|
|
size_t |
count |
|
) |
| |
|
protectedvirtual |
Read raw data from the input source.
- Parameters
-
buf | The buffer to read into. |
count | The number of bytes to read. |
- Returns
- The number of bytes actually read.
- Exceptions
-
Implements DataReader.
◆ readBytes()
size_t readBytes |
( |
byte_t * |
buf, |
|
|
size_t |
len |
|
) |
| |
|
inherited |
Read raw bytes.
The number of bytes read may be less than the number requested, if an end-of-file condition occurs.
- Parameters
-
buf | The buffer in which to place the bytes. |
len | The maximum number of bytes to read. |
- Returns
- The number of bytes actually read.
- Exceptions
-
◆ readFully()
void readFully |
( |
byte_t * |
buf, |
|
|
size_t |
len |
|
) |
| |
|
inherited |
Read raw bytes, throwing an EOFException if the exact number of bytes requested could not be read.
- Parameters
-
buf | The buffer in which to place the bytes. |
len | The exact number of bytes to read. |
- Exceptions
-
◆ readString()
void readString |
( |
String & |
v, |
|
|
uint32_t |
length |
|
) |
| |
|
protectedvirtualinherited |
Read a string from the input source.
- Parameters
-
v | The String to read into. |
length | The length of the string to read, or 0 to read a String that is preceded by a 32-bit length. |
- Exceptions
-
Reimplemented in CircularByteBufferDataReader.
◆ reset()
Reset the encoder.
Discards all but the topmost context, and resets the topmost context to default values.
- Exceptions
-
Reimplemented from DataEncoder.
◆ setEndianness()
Specify the byte-endianness for reading/writing primitive integer types in the active context.
◆ setLength()
void setLength |
( |
size_t |
length | ) |
|
|
inherited |
Specify the length of String, Blob, and array values for subsequent reading/writing in the active context.
◆ setLimit()
void setLimit |
( |
int64_t |
limit | ) |
|
|
inherited |
Specify the maximum number of bytes that can be read/written in the active context.
Attempts to read/write past this limit will raise an IOException.
- Exceptions
-
◆ setOffset()
void setOffset |
( |
int64_t |
offset | ) |
|
|
virtual |
Set the current reading/writing offset.
- Exceptions
-
Implements DataEncoder.
◆ skip()
void skip |
( |
size_t |
count | ) |
|
|
virtual |
Skip past the given number of bytes in the data stream.
When reading, the bytes are simply skipped over; when writing, the bytes are filled with NULs.
- Parameters
-
count | The number of bytes to skip. |
- Exceptions
-
Implements DataEncoder.
The documentation for this class was generated from the following files: