StreamWriter

class StreamWriter

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.

Inheritance diagram

digraph inheritancea6bf1ed179 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "StreamWriter" [URL="acron.core.StreamWriter.html#acron.core.StreamWriter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "StreamWriter" [arrowsize=0.75,style=""]; }
StreamWriter.__init__()

The copy constructor does not copy ownership of the stream.

The move constructor steals ownership of the stream.

StreamWriter.add_be_float32()

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.

StreamWriter.add_be_float64()

Adds a 64-bit big-endian floating-point number to the streamWriter.

StreamWriter.add_be_int16()

These functions pack numbers big-endian, in case that’s desired.

Adds a signed 16-bit big-endian integer to the streamWriter.

StreamWriter.add_be_int32()

Adds a signed 32-bit big-endian integer to the streamWriter.

StreamWriter.add_be_int64()

Adds a signed 64-bit big-endian integer to the streamWriter.

StreamWriter.add_be_uint16()

Adds an unsigned 16-bit big-endian integer to the streamWriter.

StreamWriter.add_be_uint32()

Adds an unsigned 32-bit big-endian integer to the streamWriter.

StreamWriter.add_be_uint64()

Adds an unsigned 64-bit big-endian integer to the streamWriter.

StreamWriter.add_bool()

Adds a boolean value to the stream.

StreamWriter.add_fixed_string()

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.

StreamWriter.add_float32()

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.

StreamWriter.add_float64()

Adds a 64-bit floating-point number to the stream.

StreamWriter.add_int16()

The default numeric packing is little-endian.

Adds a signed 16-bit integer to the stream.

StreamWriter.add_int32()

Adds a signed 32-bit integer to the stream.

StreamWriter.add_int64()

Adds a signed 64-bit integer to the stream.

StreamWriter.add_int8()

Adds a signed 8-bit integer to the stream.

StreamWriter.add_string()

Adds a variable-length string to the stream. This actually adds a count followed by n bytes.

StreamWriter.add_string32()

Adds a variable-length string to the stream, using a 32-bit length field.

StreamWriter.add_uint16()

Adds an unsigned 16-bit integer to the stream.

StreamWriter.add_uint32()

Adds an unsigned 32-bit integer to the stream.

StreamWriter.add_uint64()

Adds an unsigned 64-bit integer to the stream.

StreamWriter.add_uint8()

Adds an unsigned 8-bit integer to the stream.

StreamWriter.add_z_string()

Adds a variable-length string to the stream, as a NULL-terminated string.

StreamWriter.append_data()

Appends some more raw data to the end of the streamWriter.

Appends some more raw data to the end of the streamWriter.

StreamWriter.assign()
StreamWriter.flush()

Calls flush() on the underlying stream.

StreamWriter.get_ostream()

Returns the stream in use.

StreamWriter.pad_bytes()

Adds the indicated number of zero bytes to the stream.

StreamWriter.write()

A synonym of append_data(). This is useful when assigning the StreamWriter to sys.stderr and/or sys.stdout in Python.