Panda3D
|
This class can be used to read a binary file that consists of an arbitrary header followed by a number of datagrams. More...
Public Member Functions | |
__init__ () | |
close () | |
Closes the file. This is also implicitly done when the DatagramInputFile destructs. More... | |
Istream | getStream () |
Returns the istream represented by the input file. More... | |
bool | open (const FileReference file) |
Opens the indicated filename for reading. Returns true on success, false on failure. More... | |
bool | open (const Filename filename) |
Opens the indicated filename for reading. Returns true on success, false on failure. More... | |
bool | open (Istream in, const Filename filename) |
Starts reading from the indicated stream. Returns true on success, false on failure. The DatagramInputFile does not take ownership of the stream; you are responsible for closing or deleting it when you are done. More... | |
bool | readHeader (String header, size_t num_bytes) |
Reads a sequence of bytes from the beginning of the datagram file. This may be called any number of times after the file has been opened and before the first datagram is read. It may not be called once the first datagram has been read. More... | |
![]() | |
bool | getDatagram (Datagram data) |
const FileReference | getFile () |
Returns the FileReference that provides the source for these datagrams, if any, or NULL if the datagrams do not originate from a file on disk. More... | |
const Filename | getFilename () |
Returns the filename that provides the source for these datagrams, if any, or empty string if the datagrams do not originate from a file on disk. More... | |
Streampos | getFilePos () |
Returns the current file position within the data stream, if any, or 0 if the file position is not meaningful or cannot be determined. More... | |
time_t | getTimestamp () |
Returns the on-disk timestamp of the file that was read, at the time it was opened, if that is available, or 0 if it is not. More... | |
VirtualFile | getVfile () |
Returns the VirtualFile that provides the source for these datagrams, if any, or NULL if the datagrams do not originate from a VirtualFile. More... | |
bool | isEof () |
bool | isError () |
bool | saveDatagram (SubfileInfo info) |
Skips over the next datagram without extracting it, but saves the relevant file information in the SubfileInfo object so that its data may be read later. For non-file-based datagram generators, this may mean creating a temporary file and copying the contents of the datagram to disk. More... | |
This class can be used to read a binary file that consists of an arbitrary header followed by a number of datagrams.
__init__ | ( | ) |
close | ( | ) |
Closes the file. This is also implicitly done when the DatagramInputFile destructs.
Istream getStream | ( | ) |
Returns the istream represented by the input file.
bool open | ( | const FileReference | file | ) |
Opens the indicated filename for reading. Returns true on success, false on failure.
bool open | ( | const Filename | filename | ) |
Opens the indicated filename for reading. Returns true on success, false on failure.
Starts reading from the indicated stream. Returns true on success, false on failure. The DatagramInputFile does not take ownership of the stream; you are responsible for closing or deleting it when you are done.
bool readHeader | ( | String | header, |
size_t | num_bytes | ||
) |
Reads a sequence of bytes from the beginning of the datagram file. This may be called any number of times after the file has been opened and before the first datagram is read. It may not be called once the first datagram has been read.