panda3d.core.StreamReader

from panda3d.core import StreamReader
class StreamReader

A class to read sequential binary data directly from an istream. Its interface is similar to DatagramIterator by design; see also StreamWriter.

Inheritance diagram

Inheritance diagram of StreamReader

__init__(copy: StreamReader) → None

The copy constructor does not copy ownership of the stream.

__init__(in: istream, owns_stream: bool) → None

If owns_stream is true, the stream pointer will be deleted when the StreamReader destructs.

assign(copy: StreamReader) → StreamReader
Return type

StreamReader

extractBytes(size: size_t) → object

Extracts the indicated number of bytes in the stream and returns them as a string. Returns empty string at end-of-file.

getBeFloat32() → float

Extracts a 32-bit single-precision big-endian floating-point number. Since this kind of float is not necessarily portable across different architectures, special care is required.

getBeFloat64() → PN_float64

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

Return type

PN_float64

getBeInt16() → int16_t

Extracts a signed big-endian 16-bit integer.

Return type

int16_t

getBeInt32() → int32_t

Extracts a signed big-endian 32-bit integer.

Return type

int32_t

getBeInt64() → int64_t

Extracts a signed big-endian 64-bit integer.

Return type

int64_t

getBeUint16() → uint16_t

Extracts an unsigned big-endian 16-bit integer.

Return type

uint16_t

getBeUint32() → uint32_t

Extracts an unsigned big-endian 32-bit integer.

Return type

uint32_t

getBeUint64() → uint64_t

Extracts an unsigned big-endian 64-bit integer.

Return type

uint64_t

getBool() → bool

Extracts a boolean value.

getFixedString(size: size_t) → str

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

getFloat32() → float

Extracts a 32-bit single-precision floating-point number. Since this kind of float is not necessarily portable across different architectures, special care is required.

getFloat64() → PN_float64

Extracts a 64-bit floating-point number.

Return type

PN_float64

getInt16() → int16_t

Extracts a signed 16-bit integer.

Return type

int16_t

getInt32() → int32_t

Extracts a signed 32-bit integer.

Return type

int32_t

getInt64() → int64_t

Extracts a signed 64-bit integer.

Return type

int64_t

getInt8() → int8_t

Extracts a signed 8-bit integer.

Return type

int8_t

getIstream() → istream

Returns the stream in use.

Return type

istream

getString() → str

Extracts a variable-length string.

getString32() → str

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

getUint16() → uint16_t

Extracts an unsigned 16-bit integer.

Return type

uint16_t

getUint32() → uint32_t

Extracts an unsigned 32-bit integer.

Return type

uint32_t

getUint64() → uint64_t

Extracts an unsigned 64-bit integer.

Return type

uint64_t

getUint8() → uint8_t

Extracts an unsigned 8-bit integer.

Return type

uint8_t

getZString() → str

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

property istream

Returns the istream this object is wrapping.

Return type

istream

readline() → object

Assumes the stream represents a text file, and extracts one line up to and including the trailing newline character. Returns empty string when the end of file is reached.

The interface here is intentionally designed to be similar to that for Python’s File.readline() function.

readlines() → object
skipBytes(size: size_t) → None

Skips over the indicated number of bytes in the stream.