Panda3D
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Public Member Functions
DatagramInputFile Class Reference

This class can be used to read a binary file that consists of an arbitrary header followed by a number of datagrams. More...

Inheritance diagram for DatagramInputFile:
DatagramGenerator

List of all members.

Public Member Functions

 DatagramInputFile ()
 close ()
 Closes the file.
istream getStream ()
 Returns the istream represented by the input file.
bool open (FileReference const file)
 Opens the indicated filename for reading.
bool open (Filename const filename)
 Opens the indicated filename for reading.
bool open (istream in, Filename const filename)
 Starts reading from the indicated stream.
bool open (istream in)
 Starts reading from the indicated stream.
bool readHeader (basic_stringchar header, unsigned int num_bytes)
 Reads a sequence of bytes from the beginning of the datagram file.

Detailed Description

This class can be used to read a binary file that consists of an arbitrary header followed by a number of datagrams.


Constructor & Destructor Documentation


Member Function Documentation

close ( )

Closes the file.

This is also implicitly done when the DatagramInputFile destructs.

Returns the istream represented by the input file.

bool open ( FileReference const  file)

Opens the indicated filename for reading.

Returns true on success, false on failure.

bool open ( Filename const  filename)

Opens the indicated filename for reading.

Returns true on success, false on failure.

bool open ( istream  in,
Filename const  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.

bool open ( istream  in)

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 ( basic_stringchar  header,
unsigned int  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.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties