libcommonc++
0.7
|
A DataWriter which writes data to a CircularByteBuffer. More...
#include <CircularByteBufferDataWriter.h++>
Public Member Functions | |
CircularByteBufferDataWriter (CircularByteBuffer &buffer) | |
Construct a new CircularByteBufferDataWriter for the given CircularByteBuffer. More... | |
~CircularByteBufferDataWriter () | |
Destructor. More... | |
void | skip (uint_t count) |
void | skip (uint_t count, byte_t fillByte) |
void | flush () |
Flush any buffered but not yet written data to the output destination. More... | |
void | reset () |
Reset the encoder. More... | |
void | setOffset (int64_t offset) |
Set the current reading/writing offset. More... | |
virtual void | skip (size_t count)=0 |
Skip past the given number of bytes in the data stream. More... | |
virtual void | skip (size_t count, byte_t fillByte)=0 |
Skip past the given number of bytes, filling the bytes with the given value. More... | |
DataWriter & | operator<< (bool v) |
Write operator. More... | |
DataWriter & | operator<< (byte_t v) |
Write operator. More... | |
DataWriter & | operator<< (const byte_t *v) |
Write operator. More... | |
DataWriter & | operator<< (char v) |
Write operator. More... | |
DataWriter & | operator<< (const char *v) |
Write operator. More... | |
DataWriter & | operator<< (int16_t v) |
Write operator. More... | |
DataWriter & | operator<< (const int16_t *v) |
Write operator. More... | |
DataWriter & | operator<< (uint16_t v) |
Write operator. More... | |
DataWriter & | operator<< (const uint16_t *v) |
Write operator. More... | |
DataWriter & | operator<< (int32_t v) |
Write operator. More... | |
DataWriter & | operator<< (const int32_t *v) |
Write operator. More... | |
DataWriter & | operator<< (uint32_t v) |
Write operator. More... | |
DataWriter & | operator<< (const uint32_t *v) |
Write operator. More... | |
DataWriter & | operator<< (const int64_t &v) |
Write operator. More... | |
DataWriter & | operator<< (const int64_t *v) |
Write operator. More... | |
DataWriter & | operator<< (const uint64_t &v) |
Write operator. More... | |
DataWriter & | operator<< (const uint64_t *v) |
Write operator. More... | |
DataWriter & | operator<< (float v) |
Write operator. More... | |
DataWriter & | operator<< (const float *v) |
Write operator. More... | |
DataWriter & | operator<< (const double &v) |
Write operator. More... | |
DataWriter & | operator<< (const double *v) |
Write operator. More... | |
DataWriter & | operator<< (const Blob &v) |
Write operator. More... | |
DataWriter & | operator<< (const String &v) |
Write operator. More... | |
DataWriter & | operator<< (const Manipulator &manip) |
Write operator. More... | |
void | pushContext () |
Push a new encoder context. More... | |
void | popContext () |
Pop the active encoder context. More... | |
bool | isTopContext () const |
Determine if the active context is the topmost (and only) context. More... | |
uint_t | getContextDepth () const |
Get the current context depth. More... | |
void | setEndianness (Endianness endianness) |
Specify the byte-endianness for reading/writing primitive integer types in the active context. More... | |
Endianness | getEndianness () const |
Get the byte-endianness in the active context. More... | |
void | setLength (size_t length) |
Specify the length of String, Blob, and array values for subsequent reading/writing in the active context. More... | |
size_t | getLength () const |
Get the current length for string values. More... | |
void | setLimit (int64_t limit) |
Specify the maximum number of bytes that can be read/written in the active context. More... | |
int64_t | getLimit () const |
Get the current limit. More... | |
int64_t | getOffset () const |
Get the current encoding/decoding offset. More... | |
int64_t | getCumulativeOffset () const |
Get the cumulative reading/writing offset. More... | |
int64_t | getRemaining () const |
Get the number of bytes between the current offset and the limit, i.e., the number of bytes remaining to be read or written. More... | |
void | align (size_t size) |
Skip past enough bytes to re-align the data stream at a specified boundary. More... | |
Protected Member Functions | |
size_t | write (const byte_t *buf, size_t count) |
Write raw data to the output destination. More... | |
bool | isSameEndianness () const |
Test if the endianness of the encoder is the same as the endianness of the host system. More... | |
Context & | currentContext () |
Get a reference to the current context. More... | |
const Context & | currentContext () const |
Get a reference to the current context. More... | |
void | checkRemaining (const Context &ctx, size_t count) const |
Check if at least the given number of bytes are available to be read or written. More... | |
A DataWriter which writes data to a CircularByteBuffer.
CircularByteBufferDataWriter | ( | CircularByteBuffer & | buffer | ) |
Construct a new CircularByteBufferDataWriter for the given CircularByteBuffer.
buffer | The buffer. |
Destructor.
|
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.
size | The alignment size. Typical values include 2, 4, or 8. Other values are allowed but are of limited usefulness. |
IOException | If an I/O error occurs. |
|
protectedinherited |
Check if at least the given number of bytes are available to be read or written.
ctx | The context to check. |
count | The number of bytes. |
IOException | If there are not enough bytes remaining. |
|
protectedinherited |
Get a reference to the current context.
|
protectedinherited |
Get a reference to the current context.
|
virtual |
Flush any buffered but not yet written data to the output destination.
IOException | If an I/O error occurs. |
Implements DataWriter.
|
inherited |
Get the current context depth.
|
inherited |
Get the cumulative reading/writing offset.
This is a sum of the offsets across all contexts.
|
inherited |
Get the byte-endianness in the active context.
|
inherited |
Get the current length for string values.
|
inherited |
Get the current limit.
|
inherited |
Get the current encoding/decoding offset.
|
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.
|
protectedinherited |
Test if the endianness of the encoder is the same as the endianness of the host system.
|
inherited |
Determine if the active context is the topmost (and only) context.
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
Write operator.
IOException | If an I/O error occurs. |
|
inherited |
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.
|
inherited |
Push a new encoder context.
|
virtual |
Reset the encoder.
Discards all but the topmost context, and resets the topmost context to default values.
IOException | If an I/O error occurs. |
Reimplemented from DataEncoder.
|
inherited |
Specify the byte-endianness for reading/writing primitive integer types in the active context.
|
inherited |
|
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.
IOException | If an I/O error occurs. |
|
virtual |
Set the current reading/writing offset.
IOException | If an I/O error occurs. |
Implements DataEncoder.
|
pure virtualinherited |
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.
count | The number of bytes to skip. |
IOException | If an I/O error occurs. |
Implements DataEncoder.
Implemented in StreamDataWriter, ByteArrayDataWriter, and ByteBufferDataWriter.
void skip | ( | uint_t | count | ) |
|
pure virtualinherited |
Skip past the given number of bytes, filling the bytes with the given value.
count | The number of bytes to skip. |
fillByte | The value to write to all the skipped bytes. |
IOException | If an I/O error occurs. |
Implemented in StreamDataWriter, ByteArrayDataWriter, and ByteBufferDataWriter.
|
protectedvirtual |
Write raw data to the output destination.
IOException | If an I/O error occurs. |
Implements DataWriter.