|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |
#include "ot/io/BufferedOutputStream.h"
When bytes are written to the stream, they are copied into the internal buffer instead of being written directly to the contained output stream. When the internal buffer becomes full it is automatically flushed to the contained input stream. In this way i/o efficiency may be improved by translating multiple small write operations into one large one.
To further improve efficiency and avoid the needless copying of data, if the application performs a write request that is larger than the internal buffer, the internal buffer is bypassed and bytes are written directly to the contained output stream.
Constructor/Destructor Summary | |
BufferedOutputStream(OutputStream* pOutputStream) Constructs a BufferedOutputStream using a default buffer size and pOutputStream as the contained output stream. | |
BufferedOutputStream(OutputStream* pOutputStream, size_t bufSize) Constructs a BufferedOutputStream using pOutputStream as the contained output stream and a buffer size of bufSize. | |
~BufferedOutputStream() Writes out and destroys the internal buffer before destroying this BufferedOutputStream. |
Method Summary | |
virtual void |
close() Any buffered data is written to the output stream before it is closed and any system resources associated with the output stream are released. |
virtual void |
flush() Forces all buffered data to be written out and sent to the final data sink. |
virtual void |
flushBuffers() Forces all data buffers associated with this output stream to be written out. |
virtual void |
write(const Byte* pBuffer, size_t bufLen) Writes an array of bytes to this output stream. |
Methods inherited from class ot::ManagedObject |
addRef, getRefCount, onFinalRelease, operator=, release |
Methods inherited from class ot::io::OutputStream |
write |
Constructor/Destructor Detail |
BufferedOutputStream(OutputStream* pOutputStream)
NullPointerException
- BufferedOutputStream(OutputStream* pOutputStream, size_t bufSize)
NullPointerException
- virtual ~BufferedOutputStream()
Method Detail |
virtual void close()
IOException
- virtual void flush()
IOException
- virtual void flushBuffers()
IOException
- virtual void write(const Byte* pBuffer, size_t bufLen)
In the situation where bufLen is larger than the internal buffer size, the internal buffer will first be flushed before passing this write call directly to the contained OutputStream. By using this technique, the unnecessary copying of data is avoided.
pBuffer
- bufLen
- NullPointerException
- IOException
-
|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |