25 nassertr(!_in->eof() && !_in->fail(),
string());
30 std::string result(size, 0);
35 _in->read(&result[0], size);
36 size_t read_bytes = _in->gcount();
38 if (read_bytes == size) {
41 return result.substr(0, read_bytes);
50 nassertr(!_in->eof() && !_in->fail(),
string());
58 char *buffer = (
char *)PANDA_MALLOC_ARRAY(size);
59 _in->read(buffer, size);
60 size_t read_bytes = _in->gcount();
61 string result(buffer, read_bytes);
62 PANDA_FREE_ARRAY(buffer);
71 nassertr(!_in->eof() && !_in->fail(),
string());
75 while (!_in->fail() && ch != EOF && ch !=
'\0') {
89 nassertr(!_in->eof() && !_in->fail(),
string());
91 std::string result(size, 0);
96 _in->read(&result[0], size);
97 size_t read_bytes = _in->gcount();
98 result.resize(read_bytes);
100 size_t zero_byte = result.find(
'\0');
101 return result.substr(0, std::min(zero_byte, read_bytes));
109 nassertv(!_in->fail());
110 nassertv((
int)size >= 0);
111 nassertv(size == 0 || !_in->eof());
127 if (_in->eof() || _in->fail()) {
131 _in->read((
char *)into, size);
132 return _in->gcount();
142 if (_in->eof() || _in->fail()) {
147 _in->read((
char *)&buffer[0], size);
148 size_t read_bytes = _in->gcount();
149 buffer.resize(read_bytes);
165 while (ch != EOF && !_in->fail()) {
167 if (ch ==
'\n' || _in->eof()) {
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
std::string get_string32()
Extracts a variable-length string with a 32-bit length field.
std::string get_string()
Extracts a variable-length string.
std::string get_fixed_string(size_t size)
Extracts a fixed-length string.
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.
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_z_string()
Extracts a variable-length string, as a NULL-terminated string.
uint32_t get_uint32()
Extracts an unsigned 32-bit integer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.