Public Types | |
enum | Mode { NotOpen = 1, ReadOnly = 2, ReadWrite = 4, Append = 8, Truncate = 16 } |
Enumerates file opening modes. More... | |
Public Member Functions | |
NIODevice (void) | |
Constructs a NIODevice object. | |
virtual | ~NIODevice () |
Destroys a NIODevice object. | |
virtual void | open (Mode mode)=0 |
Opens an associated device. | |
virtual void | closeDevice (void)=0 |
Closes an associated device. | |
void | setReadBufferSize (nuint32 size) |
Sets the max size of the buffer used for reading data. | |
nuint32 | getReadBufferSize (void) const |
Gets the max size of the buffer used for reading data. | |
virtual nint32 | read (NDataStream *buffer)=0 |
Reads data from the device. | |
virtual nint32 | read (NDataStream *buffer, nuint32 bytes)=0 |
Reads data from the device. | |
virtual nint32 | readLine (NDataStream *buffer)=0 |
Reads a line from the device. | |
virtual nint32 | write (const NDataStream &data, nuint32 bytes=0)=0 |
Writes data to the device. | |
Protected Attributes | |
nuint32 | m_readBufferSize |
Definition at line 37 of file niodevice.h.
enum Mode |
Enumerates file opening modes.
NotOpen | Not open |
ReadOnly | Read Only |
ReadWrite | Read write |
Append | Append |
Truncate | Truncate |
Definition at line 43 of file niodevice.h.
virtual void open | ( | Mode | mode | ) | [pure virtual] |
Opens an associated device.
mode | Open mode as defined by enum Mode |
Implemented in NFile, and NAbstractSocket.
Referenced by NAbstractSocket::open().
void setReadBufferSize | ( | nuint32 | size | ) |
Sets the max size of the buffer used for reading data.
size | The size, in bytes, for the buffer |
Definition at line 34 of file niodevice.cpp.
References m_readBufferSize.
nuint32 getReadBufferSize | ( | void | ) | const |
Gets the max size of the buffer used for reading data.
Definition at line 39 of file niodevice.cpp.
References m_readBufferSize.
virtual nint32 read | ( | NDataStream * | buffer | ) | [pure virtual] |
Reads data from the device.
buffer | Output buffer for the bytes read |
Implemented in NFile, NTcpSocket, NAbstractSocket, and NTcpSocket.
virtual nint32 read | ( | NDataStream * | buffer, | |
nuint32 | bytes | |||
) | [pure virtual] |
Reads data from the device.
buffer | Output buffer for the bytes read | |
bytes | Number of bytes to be read from the device. |
Implemented in NFile, NTcpSocket, NAbstractSocket, and NTcpSocket.
virtual nint32 readLine | ( | NDataStream * | buffer | ) | [pure virtual] |
Reads a line from the device.
buffer | Output buffer for the bytes read |
Implemented in NFile, NTcpSocket, NAbstractSocket, and NTcpSocket.
virtual nint32 write | ( | const NDataStream & | data, | |
nuint32 | bytes = 0 | |||
) | [pure virtual] |
Writes data to the device.
data | Data to be written to the device | |
bytes | Amount of bytes to be written to the device. 0 means that all bytes of data will be written |
Implemented in NFile, NTcpSocket, NAbstractSocket, and NTcpSocket.
nuint32 m_readBufferSize [protected] |
Size of the read buffer
Definition at line 117 of file niodevice.h.
Referenced by getReadBufferSize(), NTcpSocket::read(), NFile::read(), and setReadBufferSize().