StreamWriter

from panda3d.core import StreamWriter
class StreamWriter

Bases:

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

Inheritance diagram of StreamWriter

__init__(copy: StreamWriter)

The copy constructor does not copy ownership of the stream.

__init__(out: ostream, owns_stream: bool)
add_be_float32(value: float)

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.

add_be_float64(value: float)

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

add_be_int16(value: int)

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

add_be_int32(value: int)

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

add_be_int64(value: int)

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

add_be_uint16(value: int)

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

add_be_uint32(value: int)

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

add_be_uint64(value: int)

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

add_bool(value: bool)

Adds a boolean value to the stream.

add_fixed_string(str: str, size: int)

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.

add_float32(value: float)

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.

add_float64(value: float)

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

add_int16(value: int)

Adds a signed 16-bit integer to the stream.

add_int32(value: int)

Adds a signed 32-bit integer to the stream.

add_int64(value: int)

Adds a signed 64-bit integer to the stream.

add_int8(value: int8_t)

Adds a signed 8-bit integer to the stream.

add_string(str: str)

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

add_string32(str: str)

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

add_uint16(value: int)

Adds an unsigned 16-bit integer to the stream.

add_uint32(value: int)

Adds an unsigned 32-bit integer to the stream.

add_uint64(value: int)

Adds an unsigned 64-bit integer to the stream.

add_uint8(value: uint8_t)

Adds an unsigned 8-bit integer to the stream.

add_z_string(str: str)

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

append_data(data: object)
assign(copy: StreamWriter) StreamWriter
flush()

Calls flush() on the underlying stream.

get_ostream() ostream

Returns the stream in use.

property ostream ostream

Returns the stream in use.

pad_bytes(size: int)

Adds the indicated number of zero bytes to the stream.

write(str: str)

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