activemq-cpp-3.4.0

cms::StreamMessage Class Reference

Interface for a StreamMessage. More...

#include <src/main/cms/StreamMessage.h>

Inheritance diagram for cms::StreamMessage:

Public Member Functions

virtual ~StreamMessage () throw ()
virtual bool readBoolean () const =0
 Reads a Boolean from the Stream message stream.
virtual void writeBoolean (bool value)=0
 Writes a boolean to the Stream message stream as a 1-byte value.
virtual unsigned char readByte () const =0
 Reads a Byte from the Stream message stream.
virtual void writeByte (unsigned char value)=0
 Writes a byte to the Stream message stream as a 1-byte value.
virtual int readBytes (std::vector< unsigned char > &value) const =0
 Reads a byte array from the Stream message stream.
virtual void writeBytes (const std::vector< unsigned char > &value)=0
 Writes a byte array to the Stream message stream using the vector size as the number of bytes to write.
virtual int readBytes (unsigned char *buffer, int length) const =0
 Reads a portion of the Stream message stream.
virtual void writeBytes (const unsigned char *value, int offset, int length)=0
 Writes a portion of a byte array to the Stream message stream.
virtual char readChar () const =0
 Reads a Char from the Stream message stream.
virtual void writeChar (char value)=0
 Writes a char to the Stream message stream as a 1-byte value.
virtual float readFloat () const =0
 Reads a 32 bit float from the Stream message stream.
virtual void writeFloat (float value)=0
 Writes a float to the Stream message stream as a 4 byte value.
virtual double readDouble () const =0
 Reads a 64 bit double from the Stream message stream.
virtual void writeDouble (double value)=0
 Writes a double to the Stream message stream as a 8 byte value.
virtual short readShort () const =0
 Reads a 16 bit signed short from the Stream message stream.
virtual void writeShort (short value)=0
 Writes a signed short to the Stream message stream as a 2 byte value.
virtual unsigned short readUnsignedShort () const =0
 Reads a 16 bit unsigned short from the Stream message stream.
virtual void writeUnsignedShort (unsigned short value)=0
 Writes a unsigned short to the Stream message stream as a 2 byte value.
virtual int readInt () const =0
 Reads a 32 bit signed integer from the Stream message stream.
virtual void writeInt (int value)=0
 Writes a signed int to the Stream message stream as a 4 byte value.
virtual long long readLong () const =0
 Reads a 64 bit long from the Stream message stream.
virtual void writeLong (long long value)=0
 Writes a long long to the Stream message stream as a 8 byte value.
virtual std::string readString () const =0
 Reads an ASCII String from the Stream message stream.
virtual void writeString (const std::string &value)=0
 Writes an ASCII String to the Stream message stream.

Detailed Description

Interface for a StreamMessage.

The stream Messages provides a Message type whose body is a stream of self describing primitive types. The primitive values are read and written using accessors specific to the given types.

StreamMessage objects support the following conversion table. The marked cases must be supported. The unmarked cases must throw a CMSException. The string-to- primitive conversions may throw a runtime exception if the primitive's valueOf() method does not accept it as a valid String representation of the primitive.

A value written as the row type can be read as the column type.

    |        | boolean byte short char int long float double String byte[]
    |----------------------------------------------------------------------
    |boolean |    X                                            X
    |byte    |          X     X         X   X                  X
    |short   |                X         X   X                  X
    |char    |                     X                           X
    |int     |                          X   X                  X
    |long    |                              X                  X
    |float   |                                    X     X      X
    |double  |                                          X      X
    |String  |    X     X     X         X   X     X     X      X
    |byte[]  |                                                        X
    |----------------------------------------------------------------------
 
Since:
1.3

Constructor & Destructor Documentation

virtual cms::StreamMessage::~StreamMessage ( ) throw () [virtual]

Member Function Documentation

virtual bool cms::StreamMessage::readBoolean ( ) const [pure virtual]

Reads a Boolean from the Stream message stream.

Returns:
boolean value from stream
Exceptions:
CMSException- if the CMS provider fails to read the message due to some internal error.
MessageEOFException- if unexpected end of message stream has been reached.
MessageFormatException- if this type conversion is invalid.
MessageNotReadableException- if the message is in write-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual unsigned char cms::StreamMessage::readByte ( ) const [pure virtual]

Reads a Byte from the Stream message stream.

Returns:
unsigned char value from stream
Exceptions:
CMSException- if the CMS provider fails to read the message due to some internal error.
MessageEOFException- if unexpected end of message stream has been reached.
MessageFormatException- if this type conversion is invalid.
MessageNotReadableException- if the message is in write-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual int cms::StreamMessage::readBytes ( std::vector< unsigned char > &  value) const [pure virtual]

Reads a byte array from the Stream message stream.

If the length of vector value is less than the number of bytes remaining to be read from the stream, the vector should be filled. A subsequent call reads the next increment, and so on.

If the number of bytes remaining in the stream is less than the length of vector value, the bytes should be read into the vector. The return value of the total number of bytes read will be less than the length of the vector, indicating that there are no more bytes left to be read from the stream. The next read of the stream returns -1.

Parameters:
valuebuffer to place data in
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached
Exceptions:
CMSException- if the CMS provider fails to read the message due to some internal error.
MessageEOFException- if unexpected end of message stream has been reached.
MessageFormatException- if this type conversion is invalid.
MessageNotReadableException- if the message is in write-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual int cms::StreamMessage::readBytes ( unsigned char *  buffer,
int  length 
) const [pure virtual]

Reads a portion of the Stream message stream.

If the length of array value is less than the number of bytes remaining to be read from the stream, the array should be filled. A subsequent call reads the next increment, and so on.

If the number of bytes remaining in the stream is less than the length of array value, the bytes should be read into the array. The return value of the total number of bytes read will be less than the length of the array, indicating that there are no more bytes left to be read from the stream. The next read of the stream returns -1.

If length is negative, or length is greater than the length of the array value, then an CMSException is thrown. No bytes will be read from the stream for this exception case.

Parameters:
bufferthe buffer into which the data is read
lengththe number of bytes to read; must be less than or equal to value.length
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached
Exceptions:
CMSException- if the CMS provider fails to read the message due to some internal error.
MessageEOFException- if unexpected end of message stream has been reached.
MessageFormatException- if this type conversion is invalid.
MessageNotReadableException- if the message is in write-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual char cms::StreamMessage::readChar ( ) const [pure virtual]

Reads a Char from the Stream message stream.

Returns:
char value from stream
Exceptions:
CMSException- if the CMS provider fails to read the message due to some internal error.
MessageEOFException- if unexpected end of message stream has been reached.
MessageFormatException- if this type conversion is invalid.
MessageNotReadableException- if the message is in write-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual double cms::StreamMessage::readDouble ( ) const [pure virtual]

Reads a 64 bit double from the Stream message stream.

Returns:
double value from stream
Exceptions:
CMSException- if the CMS provider fails to read the message due to some internal error.
MessageEOFException- if unexpected end of message stream has been reached.
MessageFormatException- if this type conversion is invalid.
MessageNotReadableException- if the message is in write-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual float cms::StreamMessage::readFloat ( ) const [pure virtual]

Reads a 32 bit float from the Stream message stream.

Returns:
double value from stream
Exceptions:
CMSException- if the CMS provider fails to read the message due to some internal error.
MessageEOFException- if unexpected end of message stream has been reached.
MessageFormatException- if this type conversion is invalid.
MessageNotReadableException- if the message is in write-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual int cms::StreamMessage::readInt ( ) const [pure virtual]

Reads a 32 bit signed integer from the Stream message stream.

Returns:
int value from stream
Exceptions:
CMSException- if the CMS provider fails to read the message due to some internal error.
MessageEOFException- if unexpected end of message stream has been reached.
MessageFormatException- if this type conversion is invalid.
MessageNotReadableException- if the message is in write-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual long long cms::StreamMessage::readLong ( ) const [pure virtual]

Reads a 64 bit long from the Stream message stream.

Returns:
long long value from stream
Exceptions:
CMSException- if the CMS provider fails to read the message due to some internal error.
MessageEOFException- if unexpected end of message stream has been reached.
MessageFormatException- if this type conversion is invalid.
MessageNotReadableException- if the message is in write-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual short cms::StreamMessage::readShort ( ) const [pure virtual]

Reads a 16 bit signed short from the Stream message stream.

Returns:
short value from stream
Exceptions:
CMSException- if the CMS provider fails to read the message due to some internal error.
MessageEOFException- if unexpected end of message stream has been reached.
MessageFormatException- if this type conversion is invalid.
MessageNotReadableException- if the message is in write-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual std::string cms::StreamMessage::readString ( ) const [pure virtual]

Reads an ASCII String from the Stream message stream.

Returns:
String from stream
Exceptions:
CMSException- if the CMS provider fails to read the message due to some internal error.
MessageEOFException- if unexpected end of message stream has been reached.
MessageFormatException- if this type conversion is invalid.
MessageNotReadableException- if the message is in write-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual unsigned short cms::StreamMessage::readUnsignedShort ( ) const [pure virtual]

Reads a 16 bit unsigned short from the Stream message stream.

Returns:
unsigned short value from stream
Exceptions:
CMSException- if the CMS provider fails to read the message due to some internal error.
MessageEOFException- if unexpected end of message stream has been reached.
MessageFormatException- if this type conversion is invalid.
MessageNotReadableException- if the message is in write-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual void cms::StreamMessage::writeBoolean ( bool  value) [pure virtual]

Writes a boolean to the Stream message stream as a 1-byte value.

The value true is written as the value (byte)1; the value false is written as the value (byte)0.

Parameters:
valueboolean to write to the stream
Exceptions:
CMSException- if the CMS provider fails to write the message due to some internal error.
MessageNotWriteableException- if the message is in read-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual void cms::StreamMessage::writeByte ( unsigned char  value) [pure virtual]

Writes a byte to the Stream message stream as a 1-byte value.

Parameters:
valuebyte to write to the stream
Exceptions:
CMSException- if the CMS provider fails to write the message due to some internal error.
MessageNotWriteableException- if the message is in read-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual void cms::StreamMessage::writeBytes ( const unsigned char *  value,
int  offset,
int  length 
) [pure virtual]

Writes a portion of a byte array to the Stream message stream.

size as the number of bytes to write.

Parameters:
valuebytes to write to the stream
offsetthe initial offset within the byte array
lengththe number of bytes to use
Exceptions:
CMSException- if the CMS provider fails to write the message due to some internal error.
MessageNotWriteableException- if the message is in read-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual void cms::StreamMessage::writeBytes ( const std::vector< unsigned char > &  value) [pure virtual]

Writes a byte array to the Stream message stream using the vector size as the number of bytes to write.

Parameters:
valuebytes to write to the stream
Exceptions:
CMSException- if the CMS provider fails to write the message due to some internal error.
MessageNotWriteableException- if the message is in read-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual void cms::StreamMessage::writeChar ( char  value) [pure virtual]

Writes a char to the Stream message stream as a 1-byte value.

Parameters:
valuechar to write to the stream
Exceptions:
CMSException- if the CMS provider fails to write the message due to some internal error.
MessageNotWriteableException- if the message is in read-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual void cms::StreamMessage::writeDouble ( double  value) [pure virtual]

Writes a double to the Stream message stream as a 8 byte value.

Parameters:
valuedouble to write to the stream
Exceptions:
CMSException- if the CMS provider fails to write the message due to some internal error.
MessageNotWriteableException- if the message is in read-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual void cms::StreamMessage::writeFloat ( float  value) [pure virtual]

Writes a float to the Stream message stream as a 4 byte value.

Parameters:
valuefloat to write to the stream
Exceptions:
CMSException- if the CMS provider fails to write the message due to some internal error.
MessageNotWriteableException- if the message is in read-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual void cms::StreamMessage::writeInt ( int  value) [pure virtual]

Writes a signed int to the Stream message stream as a 4 byte value.

Parameters:
valuesigned int to write to the stream
Exceptions:
CMSException- if the CMS provider fails to write the message due to some internal error.
MessageNotWriteableException- if the message is in read-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual void cms::StreamMessage::writeLong ( long long  value) [pure virtual]

Writes a long long to the Stream message stream as a 8 byte value.

Parameters:
valuesigned long long to write to the stream
Exceptions:
CMSException- if the CMS provider fails to write the message due to some internal error.
MessageNotWriteableException- if the message is in read-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual void cms::StreamMessage::writeShort ( short  value) [pure virtual]

Writes a signed short to the Stream message stream as a 2 byte value.

Parameters:
valuesigned short to write to the stream
Exceptions:
CMSException- if the CMS provider fails to write the message due to some internal error.
MessageNotWriteableException- if the message is in read-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual void cms::StreamMessage::writeString ( const std::string &  value) [pure virtual]

Writes an ASCII String to the Stream message stream.

Parameters:
valueString to write to the stream
Exceptions:
CMSException- if the CMS provider fails to write the message due to some internal error.
MessageNotWriteableException- if the message is in read-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.

virtual void cms::StreamMessage::writeUnsignedShort ( unsigned short  value) [pure virtual]

Writes a unsigned short to the Stream message stream as a 2 byte value.

Parameters:
valueunsigned short to write to the stream
Exceptions:
CMSException- if the CMS provider fails to write the message due to some internal error.
MessageNotWriteableException- if the message is in read-only mode.

Implemented in activemq::commands::ActiveMQStreamMessage.


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