25 nassertr(!_in->eof() && !_in->fail(), string());
30 char *buffer = (
char *)alloca(size);
31 _in->read(buffer, size);
32 size_t read_bytes = _in->gcount();
33 return string(buffer, read_bytes);
41 nassertr(!_in->eof() && !_in->fail(), string());
46 char *buffer = (
char *)PANDA_MALLOC_ARRAY(size);
47 _in->read(buffer, size);
48 size_t read_bytes = _in->gcount();
49 string result(buffer, read_bytes);
50 PANDA_FREE_ARRAY(buffer);
59 nassertr(!_in->eof() && !_in->fail(), string());
63 while (!_in->eof() && !_in->fail() && ch !=
'\0') {
77 nassertr(!_in->eof() && !_in->fail(), string());
79 char *buffer = (
char *)alloca(size);
80 _in->read(buffer, size);
81 size_t read_bytes = _in->gcount();
82 string result(buffer, read_bytes);
84 size_t zero_byte = result.find(
'\0');
85 return result.substr(0, zero_byte);
93 nassertv(!_in->eof() && !_in->fail());
94 nassertv((
int)size >= 0);
110 if (_in->eof() || _in->fail()) {
114 _in->read((
char *)into, size);
115 return _in->gcount();
125 if (_in->eof() || _in->fail()) {
130 _in->read((
char *)&buffer[0], size);
131 size_t read_bytes = _in->gcount();
132 buffer.resize(read_bytes);
148 while (!_in->eof() && !_in->fail()) {
std::string get_string()
Extracts a variable-length string.
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
uint32_t get_uint32()
Extracts an unsigned 32-bit integer.
size_t extract_bytes(unsigned char *into, size_t size)
Extracts the indicated number of bytes in the stream into the given character buffer.
std::string get_fixed_string(size_t size)
Extracts a fixed-length string.
std::string get_z_string()
Extracts a variable-length string, as a NULL-terminated string.
std::string get_string32()
Extracts a variable-length string with a 32-bit length field.
std::string readline()
Assumes the stream represents a text file, and extracts one line up to and including the trailing new...
void skip_bytes(size_t size)
Skips over the indicated number of bytes in the stream.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.