#include <BufferedSink.h>
Inheritance diagram for BufferedSink:
This buffer can always be written to, it overwrites any data contained if needed. The class is not thread-safe.
Definition at line 61 of file BufferedSink.h.
Public Member Functions | |
BufferedSink (Sink *sink, unsigned int size, unsigned int chunkSize=1) throw ( Exception ) | |
Constructor by an underlying Sink, buffer size and chunk size. | |
BufferedSink (const BufferedSink &buffer) throw ( Exception ) | |
Copy constructor. | |
virtual | ~BufferedSink (void) throw ( Exception ) |
Destructor. | |
virtual BufferedSink & | operator= (const BufferedSink &bs) throw ( Exception ) |
Assignment operator. | |
unsigned int | getPeak (void) const throw () |
Get the peak usage of the internal buffer. | |
virtual bool | open (void) throw ( Exception ) |
Open the BufferedSink. | |
virtual bool | isOpen (void) const throw () |
Check if a BufferedSink is open. | |
virtual bool | canWrite (unsigned int sec, unsigned int usec) throw ( Exception ) |
Check if the BufferedSink is ready to accept data. | |
virtual unsigned int | write (const void *buf, unsigned int len) throw ( Exception ) |
Write data to the BufferedSink. | |
virtual void | flush (void) throw ( Exception ) |
Flush all data that was written to the BufferedSink to the underlying Sink. | |
virtual void | close (void) throw ( Exception ) |
Close the BufferedSink. | |
Protected Member Functions | |
BufferedSink (void) throw ( Exception ) | |
Default constructor. | |
unsigned int | getSize (void) const throw () |
Get the size of the buffer. | |
unsigned int | store (const void *buffer, unsigned int bufferSize) throw ( Exception ) |
Store data in the internal buffer. |
|
Default constructor. Always throws an Exception.
Definition at line 211 of file BufferedSink.h. |
|
Constructor by an underlying Sink, buffer size and chunk size.
Definition at line 253 of file BufferedSink.h. |
|
Copy constructor.
Definition at line 108 of file BufferedSink.cpp. |
|
Destructor.
Definition at line 274 of file BufferedSink.h. |
|
Check if the BufferedSink is ready to accept data. Always returns true immediately.
Implements Sink. Definition at line 333 of file BufferedSink.h. |
|
Close the BufferedSink. Closes the underlying Sink.
Implements Sink. Definition at line 358 of file BufferedSink.cpp. |
|
Flush all data that was written to the BufferedSink to the underlying Sink.
Implements Sink. Definition at line 362 of file BufferedSink.h. References write(). Referenced by close(). |
|
Get the peak usage of the internal buffer.
Definition at line 295 of file BufferedSink.h. |
|
Get the size of the buffer.
Definition at line 222 of file BufferedSink.h. |
|
Check if a BufferedSink is open.
Implements Sink. Definition at line 318 of file BufferedSink.h. Referenced by close(). |
|
Open the BufferedSink. Opens the underlying Sink.
Implements Sink. Definition at line 307 of file BufferedSink.h. |
|
Assignment operator.
Definition at line 138 of file BufferedSink.cpp. References Sink::operator=(). |
|
Store data in the internal buffer. If there is not enough space, discard all in the buffer and the beginning of the supplied buffer if needed.
Definition at line 164 of file BufferedSink.cpp. |
|
Write data to the BufferedSink. Always reads the maximum number of chunkSize chunks buf holds. If the data can not be written to the underlying stream, it is buffered. If the buffer overflows, the oldest data is discarded.
Implements Sink. Definition at line 257 of file BufferedSink.cpp. References Sink::write(). Referenced by flush(). |