activemq-cpp-3.6.0
activemq::wireformat::openwire::utils::BooleanStream Class Reference

Manages the writing and reading of boolean data streams to and from a data source such as a DataInputStream or DataOutputStream. More...

#include <src/main/activemq/wireformat/openwire/utils/BooleanStream.h>

Public Member Functions

 BooleanStream ()
virtual ~BooleanStream ()
bool readBoolean ()
 Read a boolean data element from the internal data buffer.
void writeBoolean (bool value)
 Writes a Boolean value to the internal data buffer.
void marshal (decaf::io::DataOutputStream *dataOut)
 Marshal the data to a DataOutputStream.
void marshal (std::vector< unsigned char > &dataOut)
 Marshal the data to a STL vector of unsigned chars.
void unmarshal (decaf::io::DataInputStream *dataIn)
 Unmarshal a Boolean data stream from the Input Stream.
void clear ()
 Clears to old position markers, data starts at the beginning.
int marshalledSize ()
 Calc the size that data is marshalled to.

Detailed Description

Manages the writing and reading of boolean data streams to and from a data source such as a DataInputStream or DataOutputStream.

The booleans are stored as single bits in the stream, with the stream size pre-pended to the stream when the data is marshalled.

The serialized form of the size field can be between 1 and 3 bytes. If the number of used bytes < 64, size=1 byte If the number of used bytes >=64 and < 256 (size of an unsigned byte), size=2 bytes If the number of used bytes >=256, size=3 bytes

The high-order 2 bits (128 and 64) of the first byte of the size field are used to encode the information about the number of bytes in the size field. The only time the first byte will contain a value >=64 is if there are more bytes in the size field. If the first byte < 64, the value of the byte is simply the size value. If the first byte = 0xC0, the following unsigned byte is the size field. If the first byte = 0x80, the following short (two bytes) are the size field.

Constructor & Destructor Documentation

activemq::wireformat::openwire::utils::BooleanStream::BooleanStream ( )
virtual activemq::wireformat::openwire::utils::BooleanStream::~BooleanStream ( )
virtual

Member Function Documentation

void activemq::wireformat::openwire::utils::BooleanStream::clear ( )

Clears to old position markers, data starts at the beginning.

void activemq::wireformat::openwire::utils::BooleanStream::marshal ( decaf::io::DataOutputStream dataOut)

Marshal the data to a DataOutputStream.

Parameters
dataOut- Stream to write the data to.
Exceptions
IOExceptionif an I/O error occurs during this operation.
void activemq::wireformat::openwire::utils::BooleanStream::marshal ( std::vector< unsigned char > &  dataOut)

Marshal the data to a STL vector of unsigned chars.

Parameters
dataOut- reference to a vector to write the data to.
Exceptions
IOExceptionif an I/O error occurs during this operation.
int activemq::wireformat::openwire::utils::BooleanStream::marshalledSize ( )

Calc the size that data is marshalled to.

Returns
int size of marshalled data.
bool activemq::wireformat::openwire::utils::BooleanStream::readBoolean ( )

Read a boolean data element from the internal data buffer.

Returns
boolean from the stream
Exceptions
IOExceptionif an I/O error occurs during this operation.

Referenced by activemq::wireformat::openwire::marshal::BaseDataStreamMarshaller::tightMarshalObjectArray2().

void activemq::wireformat::openwire::utils::BooleanStream::unmarshal ( decaf::io::DataInputStream dataIn)

Unmarshal a Boolean data stream from the Input Stream.

Parameters
dataIn- Input Stream to read data from.
Exceptions
IOExceptionif an I/O error occurs during this operation.
void activemq::wireformat::openwire::utils::BooleanStream::writeBoolean ( bool  value)

Writes a Boolean value to the internal data buffer.

Parameters
value- boolean data to write.
Exceptions
IOExceptionif an I/O error occurs during this operation.

Referenced by activemq::wireformat::openwire::marshal::BaseDataStreamMarshaller::tightMarshalObjectArray1().


The documentation for this class was generated from the following file: