activemq-cpp-3.6.0
activemq::util::MarshallingSupport Class Reference

#include <src/main/activemq/util/MarshallingSupport.h>

Public Member Functions

 MarshallingSupport ()
virtual ~MarshallingSupport ()

Static Public Member Functions

static void writeString (decaf::io::DataOutputStream &dataOut, const std::string &value)
 Write the string object to the given DataOutputStream as Raw bytes, no string encoding is done on this char values in the string.
static void writeString16 (decaf::io::DataOutputStream &dataOut, const std::string &value)
 Write the string object to the given DataOutputStream as Raw bytes, no string encoding is done on this char values in the string.
static void writeString32 (decaf::io::DataOutputStream &dataOut, const std::string &value)
 Write the string object to the given DataOutputStream as Raw bytes, no string encoding is done on this char values in the string.
static std::string readString16 (decaf::io::DataInputStream &dataIn)
 Reads an Openwire encoded string from the provided DataInputStream.
static std::string readString32 (decaf::io::DataInputStream &dataIn)
 Reads an Openwire encoded string from the provided DataInputStream.
static std::string asciiToModifiedUtf8 (const std::string &asciiString)
 Given an ASCII String with byte values [0..255] convert the string to a string containing the modified UTF-8 form of that same string.
static std::string modifiedUtf8ToAscii (const std::string modifiedUtf8String)
 Given a string that contains bytes in the Java Modified UTF-8 format convert that string back into ASCII values from [0..255].

Constructor & Destructor Documentation

activemq::util::MarshallingSupport::MarshallingSupport ( )
virtual activemq::util::MarshallingSupport::~MarshallingSupport ( )
virtual

Member Function Documentation

static std::string activemq::util::MarshallingSupport::asciiToModifiedUtf8 ( const std::string &  asciiString)
static

Given an ASCII String with byte values [0..255] convert the string to a string containing the modified UTF-8 form of that same string.

This allows an ASCII string containing values greater than 127 as well as embedded NULLs to be sent to a Java client.

Parameters
asciiStringThe ASCII string to encode as Modified UTF-8
Returns
a string containing the Modified UTF-8 encoded form of the provided string.
Exceptions
UTFDataFormatExceptionif the length of the encoded string would exceed the size of an signed integer.
static std::string activemq::util::MarshallingSupport::modifiedUtf8ToAscii ( const std::string  modifiedUtf8String)
static

Given a string that contains bytes in the Java Modified UTF-8 format convert that string back into ASCII values from [0..255].

This will handle any string sent from a Java client which contains values within the [0..255] range or has embedded Nulls. Strings that have encoded values greater than 255 will cause an exception to be thrown.

Parameters
modifiedUtf8StringThe string to convert from Modified UTF-8 to ASCII.
Returns
the ASCII encoded version of the provided string.
Exceptions
UTFDataFormatExceptionif the provided string contains invalid data or the character values encoded in the string exceed ASCII value 255.
static std::string activemq::util::MarshallingSupport::readString16 ( decaf::io::DataInputStream dataIn)
static

Reads an Openwire encoded string from the provided DataInputStream.

No string processing is performed by this method, clients that know the data contains UTF-8 encoded content must use one of the utility methods of this class to decode the UTF-8 data.

This version assumes a size prefix of 16bits.

Parameters
dataInThe DataInputStream to read the String data from.
Returns
the String value.
Exceptions
IOExceptionif an I/O error occurs while writing the string.
static std::string activemq::util::MarshallingSupport::readString32 ( decaf::io::DataInputStream dataIn)
static

Reads an Openwire encoded string from the provided DataInputStream.

No string processing is performed by this method, clients that know the data contains UTF-8 encoded content must use one of the utility methods of this class to decode the UTF-8 data.

This version assumes a size prefix of 32bits.

Parameters
dataInThe DataInputStream to read the String data from.
Returns
the String value.
Exceptions
IOExceptionif an I/O error occurs while writing the string.
static void activemq::util::MarshallingSupport::writeString ( decaf::io::DataOutputStream dataOut,
const std::string &  value 
)
static

Write the string object to the given DataOutputStream as Raw bytes, no string encoding is done on this char values in the string.

User must encode to Modified UTF-8 as needed.

Parameters
dataOutThe DataOutputStream to write the String data to.
valueThre String value to write in Openwire form.
Exceptions
IOExceptionif an I/O error occurs while writing the string.
static void activemq::util::MarshallingSupport::writeString16 ( decaf::io::DataOutputStream dataOut,
const std::string &  value 
)
static

Write the string object to the given DataOutputStream as Raw bytes, no string encoding is done on this char values in the string.

User must encode to Modified UTF-8 as needed. This method write out only the size as a short and the string data no Openwire Type tag is appended.

Parameters
dataOutThe DataOutputStream to write the String data to.
valueThre String value to write in Openwire form.
Exceptions
IOExceptionif an I/O error occurs while writing the string.
static void activemq::util::MarshallingSupport::writeString32 ( decaf::io::DataOutputStream dataOut,
const std::string &  value 
)
static

Write the string object to the given DataOutputStream as Raw bytes, no string encoding is done on this char values in the string.

User must encode to Modified UTF-8 as needed. This method write out only the size as a int and the string data no Openwire Type tag is appended.

Parameters
dataOutThe DataOutputStream to write the String data to.
valueThre String value to write in Openwire form.
Exceptions
IOExceptionif an I/O error occurs while writing the string.

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