SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Related Functions
RWByteOutputStream Class Reference

Handle class for all binary output stream implementation classes. More...

#include <rw/stream/RWByteOutputStream.h>

Inheritance diagram for RWByteOutputStream:
RWHandleBase RWByteArrayOutputStream

Public Member Functions

 RWByteOutputStream (RWByteOutputStreamImp *ptr)
 
 RWByteOutputStream (const RWByteOutputStream &handle)
 
void close ()
 
void flush ()
 
bool isBad () const
 
bool isFail () const
 
bool isGood () const
 
RWByteOutputStreamoperator<< (RWByteOutputStream &(*pf)(RWByteOutputStream &))
 
RWByteOutputStream operator<< (RWByteOutputStream(*pf)(RWByteOutputStream &))
 
RWByteOutputStreamoperator<< (RWByte byteValue)
 
RWByteOutputStreamoperator= (const RWByteOutputStream &handle)
 
void write (RWByte byteValue)
 
void write (const RWByte *byteArray, RWSize numBytes)
 
- Public Member Functions inherited from RWHandleBase
bool isValid (void) const
 
bool operator!= (const RWHandleBase &second) const
 
bool operator< (const RWHandleBase &second) const
 
bool operator== (const RWHandleBase &second) const
 

Related Functions

(Note that these are not member functions.)

RWByteOutputStreamrwFlush (RWByteOutputStream &stream)
 
RWByteOutputStream rwGuard (RWByteOutputStream &stream)
 

Additional Inherited Members

- Protected Member Functions inherited from RWHandleBase
 RWHandleBase (void)
 
 RWHandleBase (RWStaticCtor)
 
 RWHandleBase (RWBodyBase *body)
 
 RWHandleBase (const RWHandleBase &second)
 
 ~RWHandleBase (void)
 
RWBodyBasebody (void) const
 
RWHandleBaseoperator= (const RWHandleBase &second)
 

Detailed Description

Handle class for all the binary output stream implementation classes. Implements the handle idiom from the handle-body pattern.

Constructor & Destructor Documentation

RWByteOutputStream::RWByteOutputStream ( RWByteOutputStreamImp ptr)
inlineexplicit

Constructor.

RWByteOutputStream::RWByteOutputStream ( const RWByteOutputStream handle)
inline

Copy constructor.

Parameters
handleA binary stream handle used to initialize the newly created handle.

Exception none.

Member Function Documentation

void RWByteOutputStream::close ( )
inline

Closes the stream.

void RWByteOutputStream::flush ( void  )
inline

Flushes the stream.

bool RWByteOutputStream::isBad ( ) const
inline

Returns true to indicate a loss of integrity resulting from an output operation.

bool RWByteOutputStream::isFail ( ) const
inline

Returns true to indicate that an output operation failed to generate the desired data.

bool RWByteOutputStream::isGood ( ) const
inline

Returns true to indicate a stream in a valid state.

RWByteOutputStream& RWByteOutputStream::operator<< ( RWByteOutputStream &(*)(RWByteOutputStream &)  pf)
inline

Inserter executing a manipulator function.

Parameters
pfThe manipulator's function pointer.
RWByteOutputStream RWByteOutputStream::operator<< ( RWByteOutputStream(*)(RWByteOutputStream &)  pf)
inline

Inserter executing a manipulator function.

Parameters
pfThe manipulator's function pointer.
RWByteOutputStream& RWByteOutputStream::operator<< ( RWByte  byteValue)
inline

Writes a single byte to the stream.

Parameters
byteValueThe byte to be written to the stream.
RWByteOutputStream& RWByteOutputStream::operator= ( const RWByteOutputStream handle)
inline

Assignment operator.

Parameters
handleA binary stream handle used to initialize this handle.

Exception none.

void RWByteOutputStream::write ( RWByte  byteValue)
inline

Writes a single byte to the stream.

Parameters
byteValueThe byte to be written to the stream.
void RWByteOutputStream::write ( const RWByte byteArray,
RWSize  numBytes 
)
inline

Writes an array of bytes to the stream.

Parameters
byteArrayA pointer to the first element of the array.
numBytesThe number of bytes to be written to the stream.

Friends And Related Function Documentation

RWByteOutputStream & rwFlush ( RWByteOutputStream stream)
related

Manipulator that flushes a binary output stream.

Parameters
streamThe binary stream to be flushed.
RWByteOutputStream rwGuard ( RWByteOutputStream stream)
related
Header File
#include <rw/stream/RWGuardedByteOutputStreamImp.h>

Manipulator that is used to guard a series of insertion operations.

Parameters
streamA binary output stream

A rwGuard() manipulator creates a temporary guarded stream that locks the internal mutex of the preceding synchronized stream. In this way, any insertions following the manipulator within the statement will be atomic, that is, uninterrupted by any other threads. Note that if the preceding stream is not a synchronized stream, the rwGuard() manipulator has no effect.

Example
// Lock the stream for the duration of all three insertions:
ostr << rwGuard << data1 << data2 << data3;

Copyright © 2022 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.