rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWByteFromStreambufInputStreamImp Class Reference
[Streams]

Concrete class that connects a binary stream to an iostreams narrow character buffer. More...

#include <rw/stream/RWByteFromStreambufInputStreamImp.h>

Inheritance diagram for RWByteFromStreambufInputStreamImp:
RWByteInputStreamImp RWInputStreamImp RWStreamImp RWBodyBase RWTCountingBody< RWMutexLock > RWTMonitor< RWMutexLock >

List of all members.

Public Member Functions

virtual ~RWByteFromStreambufInputStreamImp ()
virtual void close ()
virtual bool isEof () const
virtual bool isBad () const
virtual bool isFail () const
virtual bool isGood () const
virtual RWByte read ()
virtual RWSize read (RWByte *byteArray, RWSize numBytes)
virtual RWSize readUntil (RWByte *byteArray, RWSize maxSize, RWByte delim)
virtual RWSize available () const
virtual RWSize skip (RWSize numUnits)

Static Public Member Functions

static RWByteInputStream make (std::streambuf &source)

Protected Member Functions

 RWByteFromStreambufInputStreamImp (std::streambuf &sourceBuff)
std::streambuf & getSourceBuff ()
const std::streambuf & getSourceBuff () const

Detailed Description

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.


Constructor & Destructor Documentation

virtual RWByteFromStreambufInputStreamImp::~RWByteFromStreambufInputStreamImp (  )  [virtual]

Destructor.

RWByteFromStreambufInputStreamImp::RWByteFromStreambufInputStreamImp ( std::streambuf &  sourceBuff  )  [inline, protected]

Initializes the reference to the iostreams std::streambuf, that will be used as the source of bytes. Throws no exceptions.

Parameters:
sourceBuff The iostreams std::streambuf that will serve as the source of bytes.

Member Function Documentation

virtual RWSize RWByteFromStreambufInputStreamImp::available (  )  const [virtual]

Returns the number of bytes that can be read from the iostreams std::streambuf (used as the source of bytes), without blocking.

Implements RWInputStreamImp.

virtual void RWByteFromStreambufInputStreamImp::close (  )  [virtual]

This function does nothing. The user is responsible for closing the iostreams std::streambuf, used as the source of bytes, if necessary.

Implements RWStreamImp.

const std::streambuf& RWByteFromStreambufInputStreamImp::getSourceBuff (  )  const [inline, protected]

Returns a const reference to the iostreams std::streambuf, which is used as the source of bytes.

std::streambuf& RWByteFromStreambufInputStreamImp::getSourceBuff (  )  [inline, protected]

Returns a reference to the iostreams std::streambuf, which is used as the source of bytes.

virtual bool RWByteFromStreambufInputStreamImp::isBad (  )  const [virtual]

Returns true if the last operation performed on the iostreams std::streambuf failed.

Implements RWStreamImp.

virtual bool RWByteFromStreambufInputStreamImp::isEof (  )  const [virtual]

Returns true if there is no bytes available from the iostreams std::streambuf, used as the source of bytes.

Implements RWInputStreamImp.

virtual bool RWByteFromStreambufInputStreamImp::isFail (  )  const [virtual]

Returns true if the last operation performed on the iostreams std::streambuf failed.

Implements RWStreamImp.

virtual bool RWByteFromStreambufInputStreamImp::isGood (  )  const [virtual]

Returns true if the last operation performed on the iostreams std::streambuf succeeded.

Implements RWStreamImp.

static RWByteInputStream RWByteFromStreambufInputStreamImp::make ( std::streambuf &  source  )  [inline, static]

Constructs an RWByteFromStreambufInputStreamImp instance that uses source as the source of bytes, and returns a handle to it. Throws no exceptions.

Parameters:
source The iostreams std::streambuf that is used as the source of bytes.
virtual RWSize RWByteFromStreambufInputStreamImp::read ( RWByte byteArray,
RWSize  numBytes 
) [virtual]

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 std::streambuf.

Exceptions:
RWExternalStreamException Thrown when the call to the internal iostreams std::streambuf object fails or any propagated exceptions from that call occur.
Parameters:
byteArray Pointer to the first element of the array.
numBytes Number of bytes to be read from the stream.

Implements RWByteInputStreamImp.

virtual RWByte RWByteFromStreambufInputStreamImp::read (  )  [virtual]

Reads a single byte from the iostreams std::streambuf, used as the source of bytes.

Exceptions:
RWExternalStreamException Thrown when the call to the internal iostreams std::streambuf object fails or any propagated exceptions from that call occur.

Implements RWByteInputStreamImp.

virtual RWSize RWByteFromStreambufInputStreamImp::readUntil ( RWByte byteArray,
RWSize  maxSize,
RWByte  delim 
) [virtual]

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.

Parameters:
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.

Implements RWByteInputStreamImp.

virtual RWSize RWByteFromStreambufInputStreamImp::skip ( RWSize  numUnits  )  [virtual]

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.

Parameters:
numUnits The number of bytes to be skipped.

Implements RWInputStreamImp.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© 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.