DatagramInputFile
-
class DatagramInputFile
Bases:
DatagramGenerator
This class can be used to read a binary file that consists of an arbitrary header followed by a number of datagrams.
Inheritance diagram
-
DatagramInputFile(void)
-
void close(void)
Closes the file. This is also implicitly done when the
DatagramInputFile
destructs.
-
std::istream &get_stream(void)
Returns the istream represented by the input file.
-
bool open(FileReference const *file)
-
bool open(std::istream &in, Filename const &filename = Filename())
Opens the indicated filename for reading. Returns true on success, false on failure.
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 read_header(std::string &header, std::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.
-
DatagramInputFile(void)