Vault  4.1
Public Member Functions
VWriteBufferedStream Class Reference

VWriteBufferedStream is a helper class that buffers writes until a flush is issued; reads are not allowed. More...

#include <vwritebufferedstream.h>

Inheritance diagram for VWriteBufferedStream:
VMemoryStream VStream

List of all members.

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.

Detailed Description

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.

See also:
VBinaryIOStream
VTextIOStream
VMemoryStream
VAbstractFileStream
VBufferedFileStream
VDirectIOFileStream
VSocketStream

Definition at line 39 of file vwritebufferedstream.h.


Member Function Documentation

Vs64 VWriteBufferedStream::read ( Vu8 targetBuffer,
Vs64  numBytesToRead 
) [virtual]

Overrides VMemoryStream::read; throws a VException.

Parameters:
targetBufferthe buffer to read into
numBytesToReadthe number of bytes to read
Returns:
the actual number of bytes that could be read

Reimplemented from VMemoryStream.

Definition at line 20 of file vwritebufferedstream.cpp.

bool VWriteBufferedStream::skip ( Vs64  numBytesToSkip) [virtual]

Overrides VMemoryStream::skip; throws a VException.

Parameters:
numBytesToSkipthe number of bytes to skip

Reimplemented from VMemoryStream.

Definition at line 34 of file vwritebufferedstream.cpp.


The documentation for this class was generated from the following files:

Copyright ©1997-2014 Trygve Isaacson. All rights reserved. This documentation was generated with Doxygen.