25 nassertr(!_in->eof() && !_in->fail(), string());
33 char *buffer = (
char *)alloca(size);
34 _in->read(buffer, size);
35 size_t read_bytes = _in->gcount();
36 return string(buffer, read_bytes);
44 nassertr(!_in->eof() && !_in->fail(), string());
52 char *buffer = (
char *)PANDA_MALLOC_ARRAY(size);
53 _in->read(buffer, size);
54 size_t read_bytes = _in->gcount();
55 string result(buffer, read_bytes);
56 PANDA_FREE_ARRAY(buffer);
65 nassertr(!_in->eof() && !_in->fail(), string());
69 while (!_in->fail() && ch != EOF && ch !=
'\0') {
83 nassertr(!_in->eof() && !_in->fail(), string());
89 char *buffer = (
char *)alloca(size);
90 _in->read(buffer, size);
91 size_t read_bytes = _in->gcount();
92 string result(buffer, read_bytes);
94 size_t zero_byte = result.find(
'\0');
95 return result.substr(0, zero_byte);
103 nassertv(!_in->fail());
104 nassertv((
int)size >= 0);
105 nassertv(size == 0 || !_in->eof());
121 if (_in->eof() || _in->fail()) {
125 _in->read((
char *)into, size);
126 return _in->gcount();
136 if (_in->eof() || _in->fail()) {
141 _in->read((
char *)&buffer[0], size);
142 size_t read_bytes = _in->gcount();
143 buffer.resize(read_bytes);
159 while (ch != EOF && !_in->fail()) {
161 if (ch ==
'\n' || _in->eof()) {
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.