Panda3D
|
A class to read sequential binary data directly from an istream. More...
#include <pandadoc.hpp>
Public Member Functions | |
__init__ (const StreamReader copy) | |
The copy constructor does not copy ownership of the stream. More... | |
__init__ (Istream in, bool owns_stream) | |
If owns_stream is true, the stream pointer will be deleted when the StreamReader destructs. More... | |
object | extractBytes (int size) |
Extracts the indicated number of bytes in the stream and returns them as a string. More... | |
float | getBeFloat32 () |
Extracts a 32-bit single-precision big-endian floating-point number. More... | |
PNFloat64 | getBeFloat64 () |
Extracts a 64-bit big-endian floating-point number. More... | |
int16_t | getBeInt16 () |
Extracts a signed big-endian 16-bit integer. More... | |
int32_t | getBeInt32 () |
Extracts a signed big-endian 32-bit integer. More... | |
int64_t | getBeInt64 () |
Extracts a signed big-endian 64-bit integer. More... | |
uint16_t | getBeUint16 () |
Extracts an unsigned big-endian 16-bit integer. More... | |
uint32_t | getBeUint32 () |
Extracts an unsigned big-endian 32-bit integer. More... | |
uint64_t | getBeUint64 () |
Extracts an unsigned big-endian 64-bit integer. More... | |
bool | getBool () |
Extracts a boolean value. More... | |
str | getFixedString (int size) |
Extracts a fixed-length string. More... | |
float | getFloat32 () |
Extracts a 32-bit single-precision floating-point number. More... | |
PNFloat64 | getFloat64 () |
Extracts a 64-bit floating-point number. More... | |
int16_t | getInt16 () |
Extracts a signed 16-bit integer. More... | |
int32_t | getInt32 () |
Extracts a signed 32-bit integer. More... | |
int64_t | getInt64 () |
Extracts a signed 64-bit integer. More... | |
int8_t | getInt8 () |
Extracts a signed 8-bit integer. More... | |
Istream | getIstream () |
Returns the stream in use. More... | |
str | getString () |
Extracts a variable-length string. More... | |
str | getString32 () |
Extracts a variable-length string with a 32-bit length field. More... | |
uint16_t | getUint16 () |
Extracts an unsigned 16-bit integer. More... | |
uint32_t | getUint32 () |
Extracts an unsigned 32-bit integer. More... | |
uint64_t | getUint64 () |
Extracts an unsigned 64-bit integer. More... | |
uint8_t | getUint8 () |
Extracts an unsigned 8-bit integer. More... | |
str | getZString () |
Extracts a variable-length string, as a NULL-terminated string. More... | |
StreamReader | operator= (const StreamReader copy) |
object | readline () |
Assumes the stream represents a text file, and extracts one line up to and including the trailing newline character. More... | |
object | readlines () |
skipBytes (int size) | |
Skips over the indicated number of bytes in the stream. More... | |
Public Attributes | |
Istream | istream |
Returns the stream in use. More... | |
A class to read sequential binary data directly from an istream.
Its interface is similar to DatagramIterator by design; see also StreamWriter.
__init__ | ( | const StreamReader | copy | ) |
The copy constructor does not copy ownership of the stream.
__init__ | ( | Istream | in, |
bool | owns_stream | ||
) |
If owns_stream is true, the stream pointer will be deleted when the StreamReader destructs.
object extractBytes | ( | int | size | ) |
Extracts the indicated number of bytes in the stream and returns them as a string.
Returns empty string at end-of-file.
float getBeFloat32 | ( | ) |
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.
PNFloat64 getBeFloat64 | ( | ) |
Extracts a 64-bit big-endian floating-point number.
int16_t getBeInt16 | ( | ) |
Extracts a signed big-endian 16-bit integer.
int32_t getBeInt32 | ( | ) |
Extracts a signed big-endian 32-bit integer.
int64_t getBeInt64 | ( | ) |
Extracts a signed big-endian 64-bit integer.
uint16_t getBeUint16 | ( | ) |
Extracts an unsigned big-endian 16-bit integer.
uint32_t getBeUint32 | ( | ) |
Extracts an unsigned big-endian 32-bit integer.
uint64_t getBeUint64 | ( | ) |
Extracts an unsigned big-endian 64-bit integer.
bool getBool | ( | ) |
Extracts a boolean value.
str getFixedString | ( | int | size | ) |
Extracts a fixed-length string.
However, if a zero byte occurs within the string, it marks the end of the string.
float getFloat32 | ( | ) |
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.
PNFloat64 getFloat64 | ( | ) |
Extracts a 64-bit floating-point number.
int16_t getInt16 | ( | ) |
Extracts a signed 16-bit integer.
int32_t getInt32 | ( | ) |
Extracts a signed 32-bit integer.
int64_t getInt64 | ( | ) |
Extracts a signed 64-bit integer.
int8_t getInt8 | ( | ) |
Extracts a signed 8-bit integer.
Istream getIstream | ( | ) |
Returns the stream in use.
str getString | ( | ) |
Extracts a variable-length string.
str getString32 | ( | ) |
Extracts a variable-length string with a 32-bit length field.
uint16_t getUint16 | ( | ) |
Extracts an unsigned 16-bit integer.
uint32_t getUint32 | ( | ) |
Extracts an unsigned 32-bit integer.
uint64_t getUint64 | ( | ) |
Extracts an unsigned 64-bit integer.
uint8_t getUint8 | ( | ) |
Extracts an unsigned 8-bit integer.
str getZString | ( | ) |
Extracts a variable-length string, as a NULL-terminated string.
StreamReader operator= | ( | const StreamReader | copy | ) |
object readline | ( | ) |
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.
object readlines | ( | ) |
skipBytes | ( | int | size | ) |
Skips over the indicated number of bytes in the stream.
Istream istream |
Returns the stream in use.