Module: Advanced Tools Package: Streams
RWByteFromStreambufInputStreamImp RWByteInputStreamImp RWInputStreamImp RWStreamImp RWBodyBase
available() close() getSourceBuff() isBad() |
isEof() isFail() isGood() make() |
read() readUntil() RWByteFromStreambufInputStreamImp() skip() |
~RWByteFromStreambufInputStreamImp() |
#include <rw/stream/RWByteFromStreambufInputStreamImp.h>
Concrete class connecting a binary stream to an iostreams narrow character buffer. The iostreams buffer is used as the source for the data read from the binary stream. The iostreams buffer must be opened in binary mode. Implements the body idiom from the handle-body pattern.
RWByteFromStreambufInputStreamImp(streambuf& sourceBuff);
Initializes the reference to the iostreams std::streambuf, that will be used as the source of bytes. Throws no exceptions.
Parameter List
sourceBuff |
The iostreams std::streambuf that will serve as the source of bytes. |
virtual ~RWByteFromStreambufInputStreamImp();
Destructor.
static RWByteInputStream make(streambuf& source);
Constructs an RWByteFromStreambufInputStreamImp instance that uses source as the source of bytes, and returns a handle to it. Throws no exceptions.
Parameter List
source |
The iostreams std::streambuf that is used as the source of bytes. |
virtual RWSize available() const;
Returns the number of bytes that can be read from the iostreams std::streambuf (used as the source of bytes), without blocking.
virtual void close();
This function does nothing. The user is responsible for closing the iostreams std::streambuf, used as the source of bytes, if necessary.
virtual bool isBad() const;
Returns true if the last operation performed on the iostreams std::streambuf failed.
virtual bool isEof() const;
Returns true if there is no bytes available from the iostreams std::streambuf, used as the source of bytes.
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 RWByte read();
Reads a single byte from the iostreams std::streambuf, used as the source of bytes. Throws RWExternalStreamException and propagates any other exception thrown by the internal iostreams streambuf object.
virtual RWSize read(RWByte* byteArray, RWSize numBytes);
Reads an array of bytes from the iostreams std::streambuf, used as the source of bytes. The array must be pre-allocated to contain at least numBytes elements. The function returns the actual number of bytes extracted from the iostreams streambuf. Throws RWExternalStreamException and propagates any other exception thrown by the internal iostreams streambuf object.
Parameter List
byteArray |
Pointer to the first element of the array. |
numBytes |
Number of bytes to be read from the stream. |
virtual RWSize readUntil(RWByte* byteArray, RWSize maxSize, RWByte delim);
Reads bytes from the iostreams std::streambuf, used as the source of bytes, until the last byte read is equal to delim, or maxSize bytes have been read, or the end of the input sequence is reached. The bytes read are stored in byteArray. The function returns the actual number of bytes inserted into byteArray. If the last byte extracted is equal to delim, then it is not stored in byteArray.
Parameter List
byteArray |
Pointer to the array receiving the bytes extracted from the iostreams std::streambuf. |
maxSize |
Maximum number of bytes to be read. |
delim |
Byte value used as a delimiter. |
virtual RWSize skip(RWSize numUnits);
Skips numUnits bytes from the input sequence if possible. The function returns the actual number of bytes skipped, which can be any value between 0 and numUnits.
Parameter List
numUnits |
The number of bytes to be skipped. |
streambuf& getSourceBuff(); const streambuf& getSourceBuff() const;
These functions return a reference to the iostreams std::streambuf, which is used as the source 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.