Panda3D
|
This class can be used to write a binary file that consists of an arbitrary header followed by a number of datagrams. More...
#include <pandadoc.hpp>
Public Member Functions | |
__init__ () | |
close () | |
Closes the file. More... | |
bool | open (const Filename filename) |
Opens the indicated filename for writing. More... | |
bool | open (const FileReference file) |
Opens the indicated filename for writing. More... | |
bool | open (Ostream out, const Filename filename) |
Starts writing to the indicated stream. More... | |
bool | writeHeader (str header) |
Writes a sequence of bytes to the beginning of the datagram file. More... | |
![]() | |
bool | copyDatagram (SubfileInfo result, const Filename filename) |
Copies the file data from the entire indicated file (via the vfs) as the next datagram. More... | |
bool | copyDatagram (SubfileInfo result, const SubfileInfo source) |
Copies the file data from the range of the indicated file (outside of the vfs) as the next datagram. More... | |
flush () | |
const FileReference | getFile () |
Returns the FileReference that provides the target for these datagrams, if any, or NULL if the datagrams do not written to a file on disk. More... | |
const Filename | getFilename () |
Returns the filename that provides the target for these datagrams, if any, or empty string if the datagrams do not get written to a file on disk. More... | |
Streamoff | 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... | |
bool | isError () |
bool | putDatagram (const Datagram data) |
Public Attributes | |
Ostream | stream |
Returns the ostream represented by the output file. More... | |
![]() | |
const FileReference | file |
Returns the FileReference that provides the target for these datagrams, if any, or NULL if the datagrams do not written to a file on disk. More... | |
Streamoff | file_pos |
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... | |
const Filename | filename |
Returns the filename that provides the target for these datagrams, if any, or empty string if the datagrams do not get written to a file on disk. More... | |
This class can be used to write 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 DatagramOutputFile destructs.
bool open | ( | const Filename | filename | ) |
Opens the indicated filename for writing.
Returns true on success, false on failure.
bool open | ( | const FileReference | file | ) |
Opens the indicated filename for writing.
Returns true if successful, false on failure.
Starts writing to the indicated stream.
Returns true on success, false on failure. The DatagramOutputFile does not take ownership of the stream; you are responsible for closing or deleting it when you are done.
bool writeHeader | ( | str | header | ) |
Writes a sequence of bytes to 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 written. It may not be called once the first datagram is written.
Ostream stream |
Returns the ostream represented by the output file.