#include <filedevice.h>
Inheritance diagram for FileDevice:
Public Methods | |
FileDevice (void) | |
A constructor. More... | |
virtual | ~FileDevice (void) |
A destructor. More... | |
virtual void | prepare (const char *, int) throw (ExaltIOException) |
Prepare the device with specified file name and mode. More... | |
virtual void | prepare (void) throw (ExaltIOException) |
Prepare the device (using standard input). | |
virtual void | flush (void) throw (ExaltIOException) |
Flush the device. More... | |
virtual void | finish (void) throw (ExaltIOException) |
Finish the work with the device. More... | |
virtual IOState | readData (char *buf, IOSize length) throw (ExaltIOException) |
Read up to the specified number of bytes into the buffer. More... | |
virtual IOState | getChar (int *) throw (ExaltIOException) |
Read one char. More... | |
virtual IOState | writeData (const char *buf, IOSize length) throw (ExaltIOException) |
Write the specified number of bytes from the buffer. More... | |
virtual IOState | putChar (int) throw (ExaltIOException) |
Write one char. More... | |
virtual IOSize | bytesReadTotal (void) |
Return the number of bytes read so far. More... | |
virtual IOSize | bytesRead (void) |
Return the number of bytes read by the last read operation. More... | |
virtual IOSize | bytesWritten (void) |
Return the number of bytes written so far. More... | |
virtual bool | errorOccurred (void) |
Informs about an error. More... | |
virtual bool | eof (void) |
Informs about an end of file. More... | |
Protected Attributes | |
IOSize | bWritten |
The number of bytes written so far. | |
IOSize | bRead |
The number of bytes read so far. |
This class encapsulates the fstream functionality into the interface of IODevice.
Definition at line 47 of file filedevice.h.
|
A constructor. Initialization is performed. Definition at line 38 of file filedevice.cpp. |
|
A destructor. The device is finished. Definition at line 50 of file filedevice.cpp. References finish, and IODevice::isPrepared. |
|
Return the number of bytes read by the last read operation. Returns the number of bytes read from the device by the last read operation.
Implements IODevice. Definition at line 244 of file filedevice.cpp. References IOSize. |
|
Return the number of bytes read so far. Returns the total number of bytes read from the device.
Implements IODevice. Definition at line 233 of file filedevice.cpp. |
|
Return the number of bytes written so far. Returns the total number of bytes written to the device.
Implements IODevice. Definition at line 255 of file filedevice.cpp. |
|
Informs about an end of file. This method can be used for tests of the end of file.
Implements IODevice. Definition at line 278 of file filedevice.cpp. |
|
Informs about an error. If any of the IO operations was unsuccessful, this method can be used to test it.
Implements IODevice. Definition at line 267 of file filedevice.cpp. |
|
Finish the work with the device. This method ends the work with the device. It flushes the file and closes it. An attempt to work with finished device will cause an ExaltIOException to be raised. Implements IODevice. Definition at line 102 of file filedevice.cpp. Referenced by ExaltCodec::decode, ExaltCodec::encode, and ~FileDevice. |
|
Flush the device. Ensures that all the data is written to the device. Implements IODevice. Definition at line 90 of file filedevice.cpp. |
|
Read one char. Reads one character from the device. If an error occurred, ExaltIOException is raised.
Implements IODevice. Definition at line 155 of file filedevice.cpp. |
|
Prepare the device with specified file name and mode. Prepares the device for work with file fileName in mode mode. If fileName is NULL, and mode is ios::in (or ios::out), standard input is used (or standard output).
Definition at line 64 of file filedevice.cpp. Referenced by ExaltCodec::decode, ExaltCodec::encode, and ExaltCodec::initializePushCoder. |
|
Write one char. Writes one character to the device. If an error occurred, ExaltIOException is raised.
Implements IODevice. Definition at line 211 of file filedevice.cpp. |
|
Read up to the specified number of bytes into the buffer. Reads up to length bytes from the device and stores them in buffer. If an error occurred, ExaltIOException is raised.
Implements IODevice. Definition at line 124 of file filedevice.cpp. |
|
Write the specified number of bytes from the buffer. Writes length bytes from the buffer buf to the device. If an error occurred, ExaltIOException is raised.
Implements IODevice. Definition at line 187 of file filedevice.cpp. |