A StreamWriter object is used to write sequential binary data directly to an ostream. More...
Public Member Functions | |
StreamWriter (StreamWriter const copy) | |
The copy constructor does not copy ownership of the stream. | |
StreamWriter (ostream out, bool owns_stream) | |
addBeFloat32 (float value) | |
Adds a 32-bit single-precision big-endian floating-point number to the stream. | |
addBeFloat64 (double value) | |
Adds a 64-bit big-endian floating-point number to the streamWriter. | |
addBeInt16 (short int value) | |
Adds a signed 16-bit big-endian integer to the streamWriter. | |
addBeInt32 (int value) | |
Adds a signed 32-bit big-endian integer to the streamWriter. | |
addBeInt64 (long long int value) | |
Adds a signed 64-bit big-endian integer to the streamWriter. | |
addBeUint16 (unsigned short int value) | |
Adds an unsigned 16-bit big-endian integer to the streamWriter. | |
addBeUint32 (unsigned int value) | |
Adds an unsigned 32-bit big-endian integer to the streamWriter. | |
addBeUint64 (unsigned long long int value) | |
Adds an unsigned 64-bit big-endian integer to the streamWriter. | |
addBool (bool value) | |
Adds a boolean value to the stream. | |
addFixedString (string str, unsigned int size) | |
Adds a fixed-length string to the stream. | |
addFloat32 (float value) | |
Adds a 32-bit single-precision floating-point number to the stream. | |
addFloat64 (double value) | |
Adds a 64-bit floating-point number to the stream. | |
addInt16 (short int value) | |
Adds a signed 16-bit integer to the stream. | |
addInt32 (int value) | |
Adds a signed 32-bit integer to the stream. | |
addInt64 (long long int value) | |
Adds a signed 64-bit integer to the stream. | |
addInt8 (signed char value) | |
Adds a signed 8-bit integer to the stream. | |
addString (string str) | |
Adds a variable-length string to the stream. | |
addString32 (string str) | |
Adds a variable-length string to the stream, using a 32-bit length field. | |
addUint16 (unsigned short int value) | |
Adds an unsigned 16-bit integer to the stream. | |
addUint32 (unsigned int value) | |
Adds an unsigned 32-bit integer to the stream. | |
addUint64 (unsigned long long int value) | |
Adds an unsigned 64-bit integer to the stream. | |
addUint8 (unsigned char value) | |
Adds an unsigned 8-bit integer to the stream. | |
addZString (string str) | |
Adds a variable-length string to the stream, as a NULL-terminated string. | |
appendData (string data) | |
Appends some more raw data to the end of the streamWriter. | |
flush () | |
Calls flush() on the underlying stream. | |
ostream | getOstream () |
Returns the stream in use. | |
StreamWriter | operator= (StreamWriter const copy) |
The copy constructor does not copy ownership of the stream. | |
padBytes (unsigned int size) | |
write (string str) | |
A synonym of append_data(). |
A StreamWriter object is used to write sequential binary data directly to an ostream.
Its interface is very similar to Datagram by design; it's primarily intended as a convenience to eliminate the overhead of writing bytes to a Datagram and then writing the Datagram to a stream.
StreamWriter | ( | StreamWriter const | copy | ) |
The copy constructor does not copy ownership of the stream.
StreamWriter | ( | ostream | out, |
bool | owns_stream | ||
) |
addBeFloat32 | ( | float | value | ) |
Adds a 32-bit single-precision big-endian floating-point number to the stream.
Since this kind of float is not necessarily portable across different architectures, special care is required.
addBeFloat64 | ( | double | value | ) |
Adds a 64-bit big-endian floating-point number to the streamWriter.
addBeInt16 | ( | short int | value | ) |
Adds a signed 16-bit big-endian integer to the streamWriter.
addBeInt32 | ( | int | value | ) |
Adds a signed 32-bit big-endian integer to the streamWriter.
addBeInt64 | ( | long long int | value | ) |
Adds a signed 64-bit big-endian integer to the streamWriter.
addBeUint16 | ( | unsigned short int | value | ) |
Adds an unsigned 16-bit big-endian integer to the streamWriter.
addBeUint32 | ( | unsigned int | value | ) |
Adds an unsigned 32-bit big-endian integer to the streamWriter.
addBeUint64 | ( | unsigned long long int | value | ) |
Adds an unsigned 64-bit big-endian integer to the streamWriter.
addBool | ( | bool | value | ) |
Adds a boolean value to the stream.
addFixedString | ( | string | str, |
unsigned int | size | ||
) |
Adds a fixed-length string to the stream.
If the string given is less than the requested size, this will pad the string out with zeroes; if it is greater than the requested size, this will silently truncate the string.
addFloat32 | ( | float | value | ) |
Adds a 32-bit single-precision floating-point number to the stream.
Since this kind of float is not necessarily portable across different architectures, special care is required.
addFloat64 | ( | double | value | ) |
Adds a 64-bit floating-point number to the stream.
addString | ( | string | str | ) |
Adds a variable-length string to the stream.
This actually adds a count followed by n bytes.
addString32 | ( | string | str | ) |
Adds a variable-length string to the stream, using a 32-bit length field.
addZString | ( | string | str | ) |
Adds a variable-length string to the stream, as a NULL-terminated string.
appendData | ( | string | data | ) |
Appends some more raw data to the end of the streamWriter.
ostream getOstream | ( | ) |
Returns the stream in use.
StreamWriter operator= | ( | StreamWriter const | copy | ) |
The copy constructor does not copy ownership of the stream.
write | ( | string | str | ) |
A synonym of append_data().
This is useful when assigning the StreamWriter to sys.stderr and/or sys.stdout in Python.