Module: Advanced Tools Package: Streams
RWByteToStreambufOutputStreamImp RWByteOutputStreamImp RWOutputStreamImp RWStreamImp RWBodyBase
close() flush() getSinkBuff() |
isBad() isFail() isGood() |
make() RWByteToStreambufOutputStreamImp() write() |
~RWByteToStreambufOutputStreamImp() |
#include <rw/stream/RWByteToStreambufOutputStreamImp.h>
Concrete class connecting a binary stream to an iostreams narrow character buffer. The iostreams buffer is used as sink for the data written to the binary stream. The iostreams buffer must be opened in binary mode. Implements the body idiom from the handle-body pattern.
RWByteToStreambufOutputStreamImp(streambuf& sinkBuff);
Initializes the reference to the iostreams std::streambuf, used as the sink of bytes.
Parameter List
sinkBuff |
The iostreams std::streambuf that will serve as the sink of bytes. |
virtual ~RWByteToStreambufOutputStreamImp();
Destructor.
static RWByteOutputStream make(RW_SL_IO_STD(streambuf)& sink);
Constructs an RWByteToStreambufOutputStreamImp instance that uses sink as its sink of bytes, and returns a handle to it. Throws no exceptions.
Parameter List
sink |
The iostreams std::streambuf that is used as the sink of bytes. |
virtual void close();
This function calls flush(). The user is responsible for closing the iostreams std::streambuf used as the sink of bytes, if necessary. Throws exception RWExternalStreamException and propagates any other exception thrown by the internal iostreams streambuf object.
virtual void flush();
Forward the flush request to the iostreams std::streambuf. Throws exception RWExternalStreamException and propagates any other exception thrown by the internal iostreams streambuf object.
virtual bool isBad() const;
Returns true if the last operation performed on the iostreams std::streambuf failed.
virtual bool isFail() const;
Returns true if the last operation performed on the iostreams std::streambuf failed.
virtual bool isGood() const;
Returns true if the last operation performed on the iostreams std::streambuf succeeded.
virtual void write(RWByte byteValue);
Writes a single byte to the iostreams std::streambuf. Throws exception RWExternalStreamException and propagates any other exception thrown by the internal iostreams streambuf object.
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 and propagates any other exception thrown by the internal iostreams streambuf object.
Parameter List
byteArray |
A pointer to the first element of the array. |
numBytes |
The number of bytes to be written. |
streambuf& getSinkBuff(); const streambuf& getSinkBuff() const;
These functions return a reference to the iostreams std::streambuf, which is 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.