Module: Advanced Tools Package: Streams
RWChainedByteArrayOutputStreamImp RWByteArrayOutputStreamImp RWByteOutputStreamImp RWOutputStreamImp RWStreamImp RWBodyBase
clear() close() flush() getByteArray() |
getByteArraySize() getSinkBuff() isBad() isFail() |
isGood() make() RWChainedByteArrayOutputStreamImp() write() |
~RWChainedByteArrayOutputStreamImp() |
#include <rw/stream/RWChainedByteArrayOutputStreamImp.h>
Concrete class implementing the byte array output stream interface. Bytes inserted into an instance of class RWChainedByteArrayOutputStreamImp are stored in memory using an instance of class RWChainedMemoryStreambuf. Implements the body idiom from the handle-body pattern.
RWChainedByteArrayOutputStreamImp();
Constructor.
virtual ~RWChainedByteArrayOutputStreamImp();
Destructor.
static RWByteArrayOutputStream make();
Constructs an RWChainedByteArrayOutputStreamImp instance that uses an instance of class RWChainedMemoryStreambuf to store bytes. The function returns a handle to the implementation class.
virtual void clear();
Resets the underlying buffer.
virtual void close();
This function calls flush().
virtual void flush();
Forward the flush() request to the internal RWChainedMemoryStreambuf object.
virtual RWByte* getByteArray();
Returns a pointer to an array of bytes containing the bytes inserted into the stream since its creation, or since the last invocation of function getByteArray(), or function clear(). Users are responsible for freeing the memory associated with the array returned by this function, by using the delete[] operator.
virtual RWSize getByteArraySize() const;
Returns the size of the byte array that would be returned by a call to function getByteArray().
virtual bool isBad() const;
Returns true if the last operation performed on the internal RWChainedMemoryStreambuf object failed.
virtual bool isFail() const;
Returns true if the last operation performed on the internal RWChainedMemoryStreambuf object failed.
virtual bool isGood() const;
Returns true if the last operation performed on the internal RWChainedMemoryStreambuf object succeeded.
virtual void write(RWByte byteValue);
Writes a single byte to the iostreams std::streambuf. Throws exception RWExternalStreamException.
Parameter List
byteValue |
The byte to be written. |
virtual void write(const RWByte* byteArray, RWSize numBytes);
Writes an array of bytes to the iostreams std::streambuf. Throws exception RWIncompleteStreamOperation.
Parameter List
byteArray |
A pointer to the first element of the array. |
numBytes |
The number of bytes to be written. |
RWChainedMemoryStreambuf& getSinkBuff(); const RWChainedMemoryStreambuf& getSinkBuff() const;
These functions returns a reference to the RWChainedMemoryStreambuf, used as the sink of bytes.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.