DatagramIterator

from panda3d.core import DatagramIterator
class DatagramIterator

Bases:

A class to retrieve the individual data elements previously stored in a Datagram. Elements may be retrieved one at a time; it is up to the caller to know the correct type and order of each element.

Note that it is the responsibility of the caller to ensure that the datagram object is not destructed while this DatagramIterator is in use.

Inheritance diagram

Inheritance diagram of DatagramIterator

__init__()
__init__(datagram: Datagram, offset: int)
__init__(param0: DatagramIterator)
extract_bytes(size: int) bytes

Extracts the indicated number of bytes in the datagram and returns them as a string.

get_be_float32() float

Extracts a 32-bit big-endian single-precision floating-point number.

get_be_float64() float

Extracts a 64-bit big-endian floating-point number.

get_be_int16() int

Extracts a signed 16-bit big-endian integer.

get_be_int32() int

Extracts a signed 32-bit big-endian integer.

get_be_int64() int

Extracts a signed 64-bit big-endian integer.

get_be_uint16() int

Extracts an unsigned 16-bit big-endian integer.

get_be_uint32() int

Extracts an unsigned 32-bit big-endian integer.

get_be_uint64() int

Extracts an unsigned 64-bit big-endian integer.

get_blob() bytes

Extracts a variable-length binary blob.

get_blob32() bytes

Extracts a variable-length binary blob with a 32-bit size field.

get_bool() bool

Extracts a boolean value.

static get_class_type() TypeHandle
get_current_index() int

Returns the current position within the datagram of the next piece of data to extract.

get_datagram() Datagram

Return the datagram of this iterator.

get_fixed_string(size: int) str

Extracts a fixed-length string. However, if a zero byte occurs within the string, it marks the end of the string.

get_float32() float

Extracts a 32-bit single-precision floating-point number.

get_float64() float

Extracts a 64-bit floating-point number.

get_int16() int

Extracts a signed 16-bit integer.

get_int32() int

Extracts a signed 32-bit integer.

get_int64() int

Extracts a signed 64-bit integer.

get_int8() int8_t

Extracts a signed 8-bit integer.

get_remaining_bytes() bytes

Returns the remaining bytes in the datagram as a string, but does not extract them from the iterator.

get_remaining_size() int

Return the bytes left in the datagram.

get_stdfloat() float

Extracts either a 32-bit or a 64-bit floating-point number, according to Datagram.set_stdfloat_double().

get_string() str

Extracts a variable-length string.

get_string32() str

Extracts a variable-length string with a 32-bit length field.

get_uint16() int

Extracts an unsigned 16-bit integer.

get_uint32() int

Extracts an unsigned 32-bit integer.

get_uint64() int

Extracts an unsigned 64-bit integer.

get_uint8() uint8_t

Extracts an unsigned 8-bit integer.

get_wstring() str

Extracts a variable-length wstring (with a 32-bit length field).

get_z_string() str

Extracts a variable-length string, as a NULL-terminated string.

output(out: ostream)

Write a string representation of this instance to <out>.

peek_int16() int

Extracts a signed 16-bit integer without advancing the iterator.

peek_uint16() int

Extracts an unsigned 16-bit integer without advancing the iterator.

skip_bytes(size: int)

Skips over the indicated number of bytes in the datagram.

write(out: ostream, indent: int)

Write a string representation of this instance to <out>.