#include <Pt/System/IOStream.h>
Bidirectional stream for an IODevice. More...
Inherits BasicIOStream< char >.
Public Member Functions | |
| IOStream (std::size_t bufferSize=8192, bool extend=false) | |
| Construct with buffer size. | |
| IOStream (IODevice &device, std::size_t bufferSize=8192, bool extend=false) | |
| Construct with I/O device. | |
| ~IOStream () | |
| Destructor. | |
| IOBuffer & | ioBuffer () |
| Returns the stream buffer. | |
| IODevice * | device () |
| Returns the I/O device. | |
| void | attach (IODevice &dev) |
| Attach to I/O device. | |
| void | detach () |
| Detach from I/O device. | |
| void | discard () |
| Discards the buffer. | |
| void | reset () |
| Discards and detaches. | |
| std::streamsize | peeksome (char *buffer, std::streamsize n) |
| Peeks bytes in the stream buffer. | |
| std::streamsize | writesome (char *buffer, std::streamsize n) |
| Write as much data as fits in buffer. | |
| BasicStreamBuffer< char > * | buffer () |
| Returns the buffer. | |
| void | setBuffer (BasicStreamBuffer< char > *sb) |
| Sets the buffer. | |
IOStream is a C++ iostream whose buffer is an IOBuffer. attach() binds an IODevice. Extraction and insertion then use that device. ioBuffer() returns the buffer so beginRead() and beginWrite() can run through the same EventLoop as the device.
The stream does not own the device. The caller keeps the device alive while the stream is attached. detach() unbinds it. discard() drops buffered bytes. reset() discards and detaches.
|
inherited |
The number of bytes that can be peeked depends on the current stream buffer get area and maybe less than requested, similar to istream::readsome().