Module: Advanced Tools Package: Streams
RWByteInputStream RWHandleBase
available() close() isBad() |
isEof() isFail() isGood() |
operator>>() operator=() read() |
readUntil() RWByteInputStream() skip() |
#include <rw/stream/RWByteInputStream.h>
Handle class for all the binary input stream implementation classes. Implement the handle idiom from the handle-body pattern.
RW_EXPLICIT RWByteInputStream(RWByteInputStreamImp* body);
Constructor.
RWByteInputStream(const RWByteInputStream& handle) ;
Copy constructor. Throws no exceptions.
Parameter List
handle |
A binary stream handle used to initialize the newly created handle. |
RWByteInputStream operator>>(RWByteInputStream (*pf)(RWByteInputStream&));
Extractor executing a manipulator function.
Parameter List
pf |
The manipulator's function pointer. |
RWByteInputStream& operator=(const RWByteInputStream& handle);
Assignment operator. Throws no exceptions.
Parameter List
handle |
A binary stream handle used to initialize this handle. |
RWByteInputStream& operator>>(RWByte& byteValue);
Reads a single byte from the stream.
Parameter List
byteValue |
The byte to be read from the stream. |
RWByteInputStream& operator>>(RWByteInputStream& (*pf)(RWByteInputStream&));
Extractor executing a manipulator function.
Parameter List
pf |
The manipulator's function pointer. |
RWSize available() const;
Returns the number of bytes that can be read from the stream without blocking.
void close();
Closes the stream.
bool isBad() const;
Returns true to indicate a loss of integrity resulting from an input or output operation, such as an irrecoverable read error from a file.
bool isEof() const;
Returns true to indicate that an input operation reached the end of an input sequence.
bool isFail() const;
Returns true to indicate that an input operation failed to read the expected data.
bool isGood() const;
Returns true to indicate a stream in a valid state.
RWByte read();
Reads a single byte from the stream.
RWSize read(RWByte* byteArray, RWSize numBytes);
Reads an array of bytes from the stream. The array must be pre-allocated to contain at least numBytes elements. The function returns the actual number of bytes extracted from the stream.
Parameter List
byteArray |
A pointer to the first element of the array. |
numBytes |
The number of bytes to be read from the stream. |
RWSize readUntil(RWByte* byteArray, RWSize maxSize, RWByte delim);
Reads bytes from the stream 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 read from the stream.
Parameter List
byteArray |
A pointer to the array receiving the bytes extracted from the stream. |
maxSize |
The maximum number of bytes to be read. |
delim |
The byte value used as a delimiter. |
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. |
RWByteInputStream& rwDisc(RWByteInputStream& stream);
Manipulator that discards a byte from a stream input sequence.
Parameter List
stream |
The binary stream. |
© 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.