#include <GeneralFile.h>
Inheritance diagram for util::io::GeneralFile:
As just about everything in unix is a file, this class can be used as a front-end for device and socket communications.
Public Methods | |
GeneralFile (void) | |
Construct a new GeneralFile object. | |
virtual | ~GeneralFile () |
Destroy the file object. | |
void | write (const char *msg) throw (IOException&) |
Write a null-terminated character array to a file. | |
void | write (const std::string &msg) throw (IOException&) |
Write a string to a file. | |
virtual void | write (const void *msg, int len) throw (IOException&) |
Write data to a file. | |
void | write (int msg) throw (IOException&) |
void | write (float msg) throw (IOException&) |
std::string | readLine (void) throw (IOException&) |
Read a line from a file. | |
virtual void * | read (void *buf, int len) throw (IOException&) |
Read data from a file. | |
virtual void | open (void) throw (IOException&) |
Open a file. | |
virtual void | close (void) throw (IOException&) |
Close a file. | |
Protected Attributes | |
int | fd |
The file descriptor. |
|
Construct a new GeneralFile object. By default, the file descriptor of the file will be set to 0 (stdin). |
|
Close a file.
Reimplemented in Socket. |
|
Open a file.
Reimplemented in Socket, and util::io::RS232. |
|
Read data from a file. The other read methods call this method to implement the actual read operation. It can be overridden by subclasses if needed.
Reimplemented in Socket. |
|
Read a line from a file. This method will read bytes from a file until a newline is encountered. If the last character before the newline is carriage return (\r), it will be stripped off.
|
|
Write data to a file. The other write methods call this method to implement the actual write operation. It can be overridden by subclasses if needed.
Reimplemented in Socket. |
|
Write a string to a file.
|
|
Write a null-terminated character array to a file. The null character will not be written.
|