activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r774359 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands: ActiveMQMapMessage.cpp ActiveMQMapMessage.h ActiveMQStreamMessage.cpp ActiveMQStreamMessage.h
Date Wed, 13 May 2009 13:38:30 GMT
Author: tabish
Date: Wed May 13 13:38:30 2009
New Revision: 774359

URL: http://svn.apache.org/viewvc?rev=774359&view=rev
Log:
Adding in the skeleton implementation of StreamMessage.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQStreamMessage.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQStreamMessage.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.cpp?rev=774359&r1=774358&r2=774359&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.cpp
Wed May 13 13:38:30 2009
@@ -32,12 +32,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 ActiveMQMapMessage::ActiveMQMapMessage() :
     ActiveMQMessageTemplate<cms::MapMessage>() {
-    this->map = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 ActiveMQMapMessage::~ActiveMQMapMessage() {
-    delete map;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -54,9 +52,9 @@
         // Let the base class do its thing.
         ActiveMQMessageTemplate<cms::MapMessage>::beforeMarshal( wireFormat );
 
-        if( map != NULL && !map->isEmpty() ) {
+        if( map.get() != NULL && !map->isEmpty() ) {
             // Marshal as Content.
-            PrimitiveMapMarshaller::marshal( map, getContent() );
+            PrimitiveMapMarshaller::marshal( map.get(), getContent() );
         } else {
             clearBody();
         }
@@ -93,20 +91,19 @@
 
     try {
 
-        if( map == NULL ) {
+        if( map.get() == NULL ) {
 
             if( getContent().size() == 0 ){
-                map = new PrimitiveMap;
+                map.reset( new PrimitiveMap() );
             } else {
-                map = PrimitiveMapMarshaller::unmarshal( getContent() );
+                map.reset( PrimitiveMapMarshaller::unmarshal( getContent() ) );
             }
 
-            if( map == NULL ) {
+            if( map.get() == NULL ) {
                 throw NullPointerException(
-                    __FILE__,
-                    __LINE__,
+                    __FILE__, __LINE__,
                     "ActiveMQMapMessage::getMap() - All attempts to create a "
-                    "map have fialed." );
+                    "map have failed." );
             }
         }
     }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.h?rev=774359&r1=774358&r2=774359&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.h
Wed May 13 13:38:30 2009
@@ -30,6 +30,7 @@
 #include <cms/MapMessage.h>
 #include <vector>
 #include <string>
+#include <memory>
 
 namespace activemq{
 namespace commands{
@@ -40,7 +41,7 @@
     private:
 
         // Map Structure to hold unmarshaled Map Data
-        mutable util::PrimitiveMap* map;
+        mutable std::auto_ptr<util::PrimitiveMap> map;
 
     public:
 
@@ -84,8 +85,8 @@
             const ActiveMQMapMessage* srcMap =
                 dynamic_cast< const ActiveMQMapMessage* >( src );
 
-            if( srcMap != NULL && srcMap->map != NULL ) {
-                this->map = new util::PrimitiveMap( *srcMap->map );
+            if( srcMap != NULL && srcMap->map.get() != NULL ) {
+                this->map.reset( new util::PrimitiveMap( *srcMap->map ) );
             }
         }
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQStreamMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQStreamMessage.cpp?rev=774359&r1=774358&r2=774359&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQStreamMessage.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQStreamMessage.cpp
Wed May 13 13:38:30 2009
@@ -18,10 +18,21 @@
 
 using namespace std;
 using namespace activemq;
+using namespace activemq::util;
 using namespace activemq::commands;
+using namespace activemq::exceptions;
+using namespace activemq::wireformat;
+using namespace activemq::wireformat::openwire;
+using namespace activemq::wireformat::openwire::marshal;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
-ActiveMQStreamMessage::ActiveMQStreamMessage() {
+ActiveMQStreamMessage::ActiveMQStreamMessage() :
+    ActiveMQMessageTemplate< cms::StreamMessage >() {
+
+    this->clearBody();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -32,3 +43,265 @@
 unsigned char ActiveMQStreamMessage::getDataStructureType() const {
     return ActiveMQStreamMessage::ID_ACTIVEMQSTREAMMESSAGE;
 }
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQStreamMessage::beforeMarshal( WireFormat* wireFormat )
+    throw ( decaf::io::IOException ) {
+
+    try{
+
+        // Let the base class do its thing.
+        ActiveMQMessageTemplate<cms::StreamMessage>::beforeMarshal( wireFormat );
+
+//        if( map != NULL && !map->isEmpty() ) {
+//            // Marshal as Content.
+//            PrimitiveMapMarshaller::marshal( map, getContent() );
+//        } else {
+//            clearBody();
+//        }
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQStreamMessage::reset() throw ( cms::CMSException ) {
+
+    try{
+        this->setReadOnlyBody( true );
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool ActiveMQStreamMessage::readBoolean() const throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnlyBody();
+        return 0;
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQStreamMessage::writeBoolean( bool value ) throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnlyBody();
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+unsigned char ActiveMQStreamMessage::readByte() const throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnlyBody();
+        return 0;
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQStreamMessage::writeByte( unsigned char value ) throw ( cms::CMSException )
{
+
+    try{
+        checkReadOnlyBody();
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::size_t ActiveMQStreamMessage::readBytes( std::vector<unsigned char>& value
) const
+    throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnlyBody();
+        return 0;
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQStreamMessage::writeBytes( const std::vector<unsigned char>& value
) throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnlyBody();
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::size_t ActiveMQStreamMessage::readBytes( unsigned char*& buffer, std::size_t length
) const
+    throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnlyBody();
+        return 0;
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQStreamMessage::writeBytes( const unsigned char* value,
+                                       std::size_t offset,
+                                       std::size_t length ) throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnlyBody();
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+char ActiveMQStreamMessage::readChar() const throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnlyBody();
+        return 0;
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQStreamMessage::writeChar( char value ) throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnlyBody();
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+float ActiveMQStreamMessage::readFloat() const throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnlyBody();
+        return 0;
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQStreamMessage::writeFloat( float value ) throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnlyBody();
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+double ActiveMQStreamMessage::readDouble() const throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnlyBody();
+        return 0;
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQStreamMessage::writeDouble( double value ) throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnlyBody();
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+short ActiveMQStreamMessage::readShort() const throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnlyBody();
+        return 0;
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQStreamMessage::writeShort( short value ) throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnlyBody();
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+unsigned short ActiveMQStreamMessage::readUnsignedShort() const throw ( cms::CMSException
) {
+
+    try{
+        checkWriteOnlyBody();
+        return 0;
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQStreamMessage::writeUnsignedShort( unsigned short value ) throw ( cms::CMSException
) {
+
+    try{
+        checkReadOnlyBody();
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int ActiveMQStreamMessage::readInt() const throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnlyBody();
+        return 0;
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQStreamMessage::writeInt( int value ) throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnlyBody();
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+long long ActiveMQStreamMessage::readLong() const throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnlyBody();
+        return 0;
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQStreamMessage::writeLong( long long value ) throw ( cms::CMSException ) {
+
+    try{
+        checkReadOnlyBody();
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string ActiveMQStreamMessage::readString() const throw ( cms::CMSException ) {
+
+    try{
+        checkWriteOnlyBody();
+        return "";
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQStreamMessage::writeString( const std::string& value ) throw ( cms::CMSException
) {
+
+    try{
+        checkReadOnlyBody();
+    }
+    AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
+}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQStreamMessage.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQStreamMessage.h?rev=774359&r1=774358&r2=774359&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQStreamMessage.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQStreamMessage.h
Wed May 13 13:38:30 2009
@@ -25,13 +25,20 @@
 
 #include <activemq/util/Config.h>
 #include <activemq/commands/ActiveMQMessage.h>
+#include <activemq/commands/ActiveMQMessageTemplate.h>
+#include <cms/StreamMessage.h>
+#include <cms/MessageNotWriteableException.h>
+#include <cms/MessageNotReadableException.h>
+#include <cms/MessageFormatException.h>
+#include <cms/MessageEOFException.h>
 #include <string>
 #include <memory>
 
 namespace activemq{
 namespace commands{
 
-    class AMQCPP_API ActiveMQStreamMessage : public ActiveMQMessage {
+    class AMQCPP_API ActiveMQStreamMessage :
+        public ActiveMQMessageTemplate< cms::StreamMessage > {
     public:
 
         const static unsigned char ID_ACTIVEMQSTREAMMESSAGE = 27;
@@ -60,18 +67,307 @@
          * @return src - Source Object
          */
         virtual void copyDataStructure( const DataStructure* src ) {
-            ActiveMQMessage::copyDataStructure( src );
+            ActiveMQMessageTemplate<cms::StreamMessage>::copyDataStructure( src );
+            this->reset();
         }
 
-    public:  // ActiveMQMessage
+        /**
+         * Returns a string containing the information for this DataStructure
+         * such as its type and value of its elements.
+         * @return formatted string useful for debugging.
+         */
+        virtual std::string toString() const{
+            std::ostringstream stream;
+
+            stream << "Begin Class = ActiveMQStreamMessage" << std::endl;
+            stream << ActiveMQMessageTemplate<cms::StreamMessage>::toString();
+            stream << "End Class = ActiveMQStreamMessage" << std::endl;
+
+            return stream.str();
+        }
+
+        /**
+         * Compares the DataStructure passed in to this one, and returns if
+         * they are equivalent.  Equivalent here means that they are of the
+         * same type, and that each element of the objects are the same.
+         * @returns true if DataStructure's are Equal.
+         */
+        virtual bool equals( const DataStructure* value ) const {
+            return ActiveMQMessageTemplate<cms::StreamMessage>::equals( value );
+        }
+
+        /**
+         * Determine if this object is aware of marshaling and should have
+         * its before and after marshaling methods called.  Defaults to false.
+         * @returns true if aware of marshaling
+         */
+        virtual bool isMarshalAware() const {
+            return true;
+        }
+
+        /**
+         * Perform any processing needed before an marshal
+         * @param wireformat - the OpenWireFormat object in use.
+         */
+        virtual void beforeMarshal( wireformat::WireFormat* wireFormat )
+            throw ( decaf::io::IOException );
+
+    public:   // CMS Message
+
+        /**
+         * Clone this message exactly, returns a new instance that the
+         * caller is required to delete.
+         * @return new copy of this message
+         */
+        virtual cms::StreamMessage* clone() const {
+            return dynamic_cast<cms::StreamMessage*>( this->cloneDataStructure()
);
+        }
+
+        /**
+         * Clears out the body of the message.  This does not clear the
+         * headers or properties.
+         */
+        virtual void clearBody(){
+
+            // Invoke base class's version.
+            ActiveMQMessageTemplate<cms::StreamMessage>::clearBody();
+        }
+
+    public: // CMS Stream Message
+
+        /**
+         * Puts the message body in read-only mode and repositions the stream
+         * of bytes to the beginning.
+         * @throws CMSException
+         */
+        virtual void reset() throw ( cms::CMSException );
+
+        /**
+         * Reads a Boolean from the Bytes message stream
+         * @returns boolean value from stream
+         * @throws CMSException
+         */
+        virtual bool readBoolean() const throw ( cms::CMSException );
+
+        /**
+         * Writes a boolean to the bytes 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.
+         * @param value - boolean to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeBoolean( bool value ) throw ( cms::CMSException );
+
+        /**
+         * Reads a Byte from the Bytes message stream
+         * @returns unsigned char value from stream
+         * @throws CMSException
+         */
+        virtual unsigned char readByte() const throw ( cms::CMSException );
+
+        /**
+         * Writes a byte to the bytes message stream as a 1-byte value
+         * @param value - byte to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeByte( unsigned char value ) throw ( cms::CMSException );
+
+        /**
+         * Reads a byte array from the bytes 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.
+         *
+         * @param value - buffer 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
+         * @throws CMSException if an error occurs.
+         */
+        virtual std::size_t readBytes( std::vector<unsigned char>& value ) const
+            throw ( cms::CMSException );
+
+        /**
+         * Writes a byte array to the bytes message stream using the vector
+         * size as the number of bytes to write.
+         * @param value - bytes to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeBytes(
+            const std::vector<unsigned char>& value ) throw ( cms::CMSException
);
+
+        /**
+         * Reads a portion of the bytes 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 IndexOutOfBoundsException is thrown. No bytes
+         * will be read from the stream for this exception case.
+         *
+         * @param value - the buffer into which the data is read
+         * @param length - the 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
+         * @throws CMSException
+         */
+        virtual std::size_t readBytes( unsigned char*& buffer, std::size_t length ) const
+            throw ( cms::CMSException );
+
+        /**
+         * Writes a portion of a byte array to the bytes message stream.
+         * size as the number of bytes to write.
+         * @param value - bytes to write to the stream
+         * @param offset - the initial offset within the byte array
+         * @param length - the number of bytes to use
+         * @throws CMSException
+         */
+        virtual void writeBytes( const unsigned char* value,
+                                 std::size_t offset,
+                                 std::size_t length ) throw ( cms::CMSException );
+
+        /**
+         * Reads a Char from the Bytes message stream
+         * @returns char value from stream
+         * @throws CMSException
+         */
+        virtual char readChar() const throw ( cms::CMSException );
+
+        /**
+         * Writes a char to the bytes message stream as a 1-byte value
+         * @param value - char to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeChar( char value ) throw ( cms::CMSException );
+
+        /**
+         * Reads a 32 bit float from the Bytes message stream
+         * @returns double value from stream
+         * @throws CMSException
+         */
+        virtual float readFloat() const throw ( cms::CMSException );
+
+        /**
+         * Writes a float to the bytes message stream as a 4 byte value
+         * @param value - float to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeFloat( float value ) throw ( cms::CMSException );
+
+        /**
+         * Reads a 64 bit double from the Bytes message stream
+         * @returns double value from stream
+         * @throws CMSException
+         */
+        virtual double readDouble() const throw ( cms::CMSException );
+
+        /**
+         * Writes a double to the bytes message stream as a 8 byte value
+         * @param value - double to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeDouble( double value ) throw ( cms::CMSException );
+
+        /**
+         * Reads a 16 bit signed short from the Bytes message stream
+         * @returns short value from stream
+         * @throws CMSException
+         */
+        virtual short readShort() const throw ( cms::CMSException );
+
+        /**
+         * Writes a signed short to the bytes message stream as a 2 byte value
+         * @param value - signed short to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeShort( short value ) throw ( cms::CMSException );
+
+        /**
+         * Reads a 16 bit unsigned short from the Bytes message stream
+         * @returns unsigned short value from stream
+         * @throws CMSException
+         */
+        virtual unsigned short readUnsignedShort() const throw ( cms::CMSException );
+
+        /**
+         * Writes a unsigned short to the bytes message stream as a 2 byte value
+         * @param value - unsigned short to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeUnsignedShort( unsigned short value ) throw ( cms::CMSException
);
+
+        /**
+         * Reads a 32 bit signed intger from the Bytes message stream
+         * @returns int value from stream
+         * @throws CMSException
+         */
+        virtual int readInt() const throw ( cms::CMSException );
+
+        /**
+         * Writes a signed int to the bytes message stream as a 4 byte value
+         * @param value - signed int to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeInt( int value ) throw ( cms::CMSException );
+
+        /**
+         * Reads a 64 bit long from the Bytes message stream
+         * @returns long long value from stream
+         * @throws CMSException
+         */
+        virtual long long readLong() const throw ( cms::CMSException );
+
+        /**
+         * Writes a long long to the bytes message stream as a 8 byte value
+         * @param value - signed long long to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeLong( long long value ) throw ( cms::CMSException );
+
+        /**
+         * Reads an ASCII String from the Bytes message stream
+         * @returns String from stream
+         * @throws CMSException
+         */
+        virtual std::string readString() const throw ( cms::CMSException );
+
+        /**
+         * Writes an ASCII String to the Bytes message stream
+         * @param value - String to write to the stream
+         * @throws CMSException
+         */
+        virtual void writeString( const std::string& value ) throw ( cms::CMSException
);
+
+    protected:
 
         /**
-         * Returns if this message has expired, meaning that its
-         * Expiration time has elapsed.
-         * @returns true if message is expired.
+         * Throws an exception if in write-only mode.
+         * @throws CMSException.
          */
-        virtual bool isExpired() const {
-            return false;
+        void checkWriteOnlyBody() const throw ( cms::CMSException ){
+            if( !this->isReadOnlyBody() ){
+                throw exceptions::ActiveMQException(
+                    __FILE__, __LINE__,
+                    "message is in read-only mode and "
+                    "cannot be written to" ).convertToCMSException();
+            }
         }
 
     };



Mime
View raw message