![]() |
Vault
4.1
|
VWriteBufferedStream is a helper class that buffers writes until a flush is issued; reads are not allowed. More...
#include <vwritebufferedstream.h>
Public Member Functions | |
VWriteBufferedStream (VStream &rawStream, Vs64 initialBufferSize=VMemoryStream::kDefaultBufferSize, Vs64 resizeIncrement=VMemoryStream::kIncrement2x) | |
Constructor. | |
virtual | ~VWriteBufferedStream () |
Destructor. | |
virtual Vs64 | read (Vu8 *targetBuffer, Vs64 numBytesToRead) |
Overrides VMemoryStream::read; throws a VException. | |
virtual void | flush () |
Overrides VMemoryStream::flush in order to copy the buffered data to the raw stream. | |
virtual bool | skip (Vs64 numBytesToSkip) |
Overrides VMemoryStream::skip; throws a VException. |
VWriteBufferedStream is a helper class that buffers writes until a flush is issued; reads are not allowed.
You may seek() within the written data until it is flushed; once a chunk of data is flushed, the buffered part of the stream is reset to empty, so you can't seek in it. The idea is that you may do a series of writes and seeks, followed by a flush, which appends all pending data to the underlying raw stream.
Thus you must instantiate a raw stream and supply it to the VWriteBufferedStream so it has an actual stream to do i/o on. You will then typically instantiate a VIOStream-derived object for i/o, and construct it with the VWriteBufferedStream.
Definition at line 39 of file vwritebufferedstream.h.
Overrides VMemoryStream::read; throws a VException.
targetBuffer | the buffer to read into |
numBytesToRead | the number of bytes to read |
Reimplemented from VMemoryStream.
Definition at line 20 of file vwritebufferedstream.cpp.
bool VWriteBufferedStream::skip | ( | Vs64 | numBytesToSkip | ) | [virtual] |
Overrides VMemoryStream::skip; throws a VException.
numBytesToSkip | the number of bytes to skip |
Reimplemented from VMemoryStream.
Definition at line 34 of file vwritebufferedstream.cpp.