StreamWriter

from panda3d.core import StreamWriter
class StreamWriter

Bases: DTOOL_SUPER_BASE

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__(*args, **kwargs)
addBeFloat32()

C++ Interface: add_be_float32(const StreamWriter self, 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()

C++ Interface: add_be_float64(const StreamWriter self, double value)

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

*/

addBeInt16()

C++ Interface: add_be_int16(const StreamWriter self, int value)

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

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

*/

addBeInt32()

C++ Interface: add_be_int32(const StreamWriter self, int value)

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

*/

addBeInt64()

C++ Interface: add_be_int64(const StreamWriter self, long value)

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

*/

addBeUint16()

C++ Interface: add_be_uint16(const StreamWriter self, int value)

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

*/

addBeUint32()

C++ Interface: add_be_uint32(const StreamWriter self, int value)

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

*/

addBeUint64()

C++ Interface: add_be_uint64(const StreamWriter self, long value)

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

*/

addBool()

C++ Interface: add_bool(const StreamWriter self, bool value)

/**
  • Adds a boolean value to the stream.

*/

addFixedString()

C++ Interface: add_fixed_string(const StreamWriter self, str str, 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()

C++ Interface: add_float32(const StreamWriter self, 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()

C++ Interface: add_float64(const StreamWriter self, double value)

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

*/

addInt16()

C++ Interface: add_int16(const StreamWriter self, int value)

// The default numeric packing is little-endian.

/**
  • Adds a signed 16-bit integer to the stream.

*/

addInt32()

C++ Interface: add_int32(const StreamWriter self, int value)

/**
  • Adds a signed 32-bit integer to the stream.

*/

addInt64()

C++ Interface: add_int64(const StreamWriter self, long value)

/**
  • Adds a signed 64-bit integer to the stream.

*/

addInt8()

C++ Interface: add_int8(const StreamWriter self, int value)

/**
  • Adds a signed 8-bit integer to the stream.

*/

addString()

C++ Interface: add_string(const StreamWriter self, str str)

/**
  • Adds a variable-length string to the stream. This actually adds a count

  • followed by n bytes.

*/

addString32()

C++ Interface: add_string32(const StreamWriter self, str str)

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

*/

addUint16()

C++ Interface: add_uint16(const StreamWriter self, int value)

/**
  • Adds an unsigned 16-bit integer to the stream.

*/

addUint32()

C++ Interface: add_uint32(const StreamWriter self, int value)

/**
  • Adds an unsigned 32-bit integer to the stream.

*/

addUint64()

C++ Interface: add_uint64(const StreamWriter self, long value)

/**
  • Adds an unsigned 64-bit integer to the stream.

*/

addUint8()

C++ Interface: add_uint8(const StreamWriter self, int value)

/**
  • Adds an unsigned 8-bit integer to the stream.

*/

addZString()

C++ Interface: add_z_string(const StreamWriter self, str str)

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

*/

add_be_float32()

C++ Interface: add_be_float32(const StreamWriter self, 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.

*/

add_be_float64()

C++ Interface: add_be_float64(const StreamWriter self, double value)

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

*/

add_be_int16()

C++ Interface: add_be_int16(const StreamWriter self, int value)

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

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

*/

add_be_int32()

C++ Interface: add_be_int32(const StreamWriter self, int value)

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

*/

add_be_int64()

C++ Interface: add_be_int64(const StreamWriter self, long value)

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

*/

add_be_uint16()

C++ Interface: add_be_uint16(const StreamWriter self, int value)

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

*/

add_be_uint32()

C++ Interface: add_be_uint32(const StreamWriter self, int value)

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

*/

add_be_uint64()

C++ Interface: add_be_uint64(const StreamWriter self, long value)

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

*/

add_bool()

C++ Interface: add_bool(const StreamWriter self, bool value)

/**
  • Adds a boolean value to the stream.

*/

add_fixed_string()

C++ Interface: add_fixed_string(const StreamWriter self, str str, 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.

*/

add_float32()

C++ Interface: add_float32(const StreamWriter self, 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.

*/

add_float64()

C++ Interface: add_float64(const StreamWriter self, double value)

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

*/

add_int16()

C++ Interface: add_int16(const StreamWriter self, int value)

// The default numeric packing is little-endian.

/**
  • Adds a signed 16-bit integer to the stream.

*/

add_int32()

C++ Interface: add_int32(const StreamWriter self, int value)

/**
  • Adds a signed 32-bit integer to the stream.

*/

add_int64()

C++ Interface: add_int64(const StreamWriter self, long value)

/**
  • Adds a signed 64-bit integer to the stream.

*/

add_int8()

C++ Interface: add_int8(const StreamWriter self, int value)

/**
  • Adds a signed 8-bit integer to the stream.

*/

add_string()

C++ Interface: add_string(const StreamWriter self, str str)

/**
  • Adds a variable-length string to the stream. This actually adds a count

  • followed by n bytes.

*/

add_string32()

C++ Interface: add_string32(const StreamWriter self, str str)

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

*/

add_uint16()

C++ Interface: add_uint16(const StreamWriter self, int value)

/**
  • Adds an unsigned 16-bit integer to the stream.

*/

add_uint32()

C++ Interface: add_uint32(const StreamWriter self, int value)

/**
  • Adds an unsigned 32-bit integer to the stream.

*/

add_uint64()

C++ Interface: add_uint64(const StreamWriter self, long value)

/**
  • Adds an unsigned 64-bit integer to the stream.

*/

add_uint8()

C++ Interface: add_uint8(const StreamWriter self, int value)

/**
  • Adds an unsigned 8-bit integer to the stream.

*/

add_z_string()

C++ Interface: add_z_string(const StreamWriter self, str str)

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

*/

appendData()

C++ Interface: append_data(const StreamWriter self, object data)

/**
  • Appends some more raw data to the end of the streamWriter.

*/

/**
  • Appends some more raw data to the end of the streamWriter.

*/

append_data()

C++ Interface: append_data(const StreamWriter self, object data)

/**
  • Appends some more raw data to the end of the streamWriter.

*/

/**
  • Appends some more raw data to the end of the streamWriter.

*/

assign()

C++ Interface: assign(const StreamWriter self, const StreamWriter copy)

flush()

C++ Interface: flush(const StreamWriter self)

/**
  • Calls flush() on the underlying stream.

*/

getOstream()

C++ Interface: get_ostream(StreamWriter self)

/**
  • Returns the stream in use.

*/

get_ostream()

C++ Interface: get_ostream(StreamWriter self)

/**
  • Returns the stream in use.

*/

ostream
padBytes()

C++ Interface: pad_bytes(const StreamWriter self, int size)

/**
  • Adds the indicated number of zero bytes to the stream.

*/

pad_bytes()

C++ Interface: pad_bytes(const StreamWriter self, int size)

/**
  • Adds the indicated number of zero bytes to the stream.

*/

write()

C++ Interface: write(const StreamWriter self, str str)

/**
  • A synonym of append_data(). This is useful when assigning the StreamWriter

  • to sys.stderr and/or sys.stdout in Python.

*/