You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2012/10/04 01:10:48 UTC

svn commit: r1393808 [2/3] - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataOutputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataOutputStream.cpp?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataOutputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataOutputStream.cpp Wed Oct  3 23:10:47 2012
@@ -27,8 +27,8 @@ using namespace decaf::util;
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
-DataOutputStream::DataOutputStream( OutputStream* outputStream, bool own )
- : FilterOutputStream( outputStream, own ), written(0) {
+DataOutputStream::DataOutputStream(OutputStream* outputStream, bool own) :
+    FilterOutputStream(outputStream, own), written(0) {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -36,325 +36,299 @@ DataOutputStream::~DataOutputStream() {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::doWriteByte( const unsigned char c ) {
+void DataOutputStream::doWriteByte(const unsigned char c) {
     try {
 
-        if( outputStream == NULL ) {
-            throw IOException(
-                __FILE__, __LINE__,
-                "DataOutputStream::write - Base stream is Null");
+        if (outputStream == NULL) {
+            throw IOException(__FILE__, __LINE__, "DataOutputStream::write - Base stream is Null");
         }
 
-        outputStream->write( c );
+        outputStream->write(c);
         written++;
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length ) {
+void DataOutputStream::doWriteArrayBounded(const unsigned char* buffer, int size, int offset, int length) {
 
-    try {
-
-        if( length == 0 ) {
-            return;
-        }
+    if (length == 0) {
+        return;
+    }
 
-        if( isClosed() ) {
-            throw IOException(
-                __FILE__, __LINE__,
-                "DataOutputStream::write - Base stream is Null");
-        }
+    if (isClosed()) {
+        throw IOException(__FILE__, __LINE__, "DataOutputStream::write - Base stream is Null");
+    }
 
-        if( buffer == NULL ) {
-            throw NullPointerException(
-                __FILE__, __LINE__,
-                "DataOutputStream::write - passed buffer is Null" );
-        }
+    if (buffer == NULL) {
+        throw NullPointerException(__FILE__, __LINE__, "DataOutputStream::write - passed buffer is Null");
+    }
 
-        if( size < 0 ) {
-            throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "size parameter out of Bounds: %d.", size );
-        }
+    if (size < 0) {
+        throw IndexOutOfBoundsException(__FILE__, __LINE__, "size parameter out of Bounds: %d.", size);
+    }
 
-        if( offset > size || offset < 0 ) {
-            throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "offset parameter out of Bounds: %d.", offset );
-        }
+    if (offset > size || offset < 0) {
+        throw IndexOutOfBoundsException(__FILE__, __LINE__, "offset parameter out of Bounds: %d.", offset);
+    }
 
-        if( length < 0 || length > size - offset ) {
-            throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
-        }
+    if (length < 0 || length > size - offset) {
+        throw IndexOutOfBoundsException(__FILE__, __LINE__, "length parameter out of Bounds: %d.", length);
+    }
 
-        outputStream->write( buffer, size, offset, length );
+    try {
+        outputStream->write(buffer, size, offset, length);
         written += length;
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCH_RETHROW( NullPointerException )
-    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCH_RETHROW(NullPointerException)
+    DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeBoolean( bool value ) {
+void DataOutputStream::writeBoolean(bool value) {
     try {
 
         value == true ? buffer[0] = 1 : buffer[0] = 0;
 
-        if( outputStream == NULL ) {
-            throw IOException(
-                __FILE__, __LINE__,
-                "DataOutputStream::write - Base stream is Null");
+        if (outputStream == NULL) {
+            throw IOException(__FILE__, __LINE__, "DataOutputStream::write - Base stream is Null");
         }
 
-        outputStream->write( buffer[0] );
+        outputStream->write(buffer[0]);
         written++;
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeByte( unsigned char value ) {
+void DataOutputStream::writeByte(unsigned char value) {
     try {
 
-        if( outputStream == NULL ) {
-            throw IOException(
-                __FILE__, __LINE__,
-                "DataOutputStream::write - Base stream is Null");
+        if (outputStream == NULL) {
+            throw IOException(__FILE__, __LINE__, "DataOutputStream::write - Base stream is Null");
         }
 
-        outputStream->write( value );
+        outputStream->write(value);
         written++;
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeChar( char value ) {
+void DataOutputStream::writeChar(char value) {
     try {
 
-        if( outputStream == NULL ) {
-            throw IOException(
-                __FILE__, __LINE__,
-                "DataOutputStream::write - Base stream is Null");
+        if (outputStream == NULL) {
+            throw IOException(__FILE__, __LINE__, "DataOutputStream::write - Base stream is Null");
         }
 
-        outputStream->write( value );
+        outputStream->write(value);
         written++;
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeShort( short value ) {
+void DataOutputStream::writeShort(short value) {
     try {
 
-        if( outputStream == NULL ) {
-            throw IOException(
-                __FILE__, __LINE__,
-                "DataOutputStream::write - Base stream is Null");
+        if (outputStream == NULL) {
+            throw IOException(__FILE__, __LINE__, "DataOutputStream::write - Base stream is Null");
         }
 
-        buffer[0] = (unsigned char)((value & 0xFF00) >> 8);
-        buffer[1] = (unsigned char)((value & 0x00FF) >> 0);
+        buffer[0] = (unsigned char) ((value & 0xFF00) >> 8);
+        buffer[1] = (unsigned char) ((value & 0x00FF) >> 0);
 
-        outputStream->write( buffer, sizeof(value), 0, sizeof(value) );
-        written += sizeof( value );
+        outputStream->write(buffer, sizeof(value), 0, sizeof(value));
+        written += sizeof(value);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeUnsignedShort( unsigned short value ) {
+void DataOutputStream::writeUnsignedShort(unsigned short value) {
     try {
 
-        if( outputStream == NULL ) {
-            throw IOException(
-                __FILE__, __LINE__,
-                "DataOutputStream::write - Base stream is Null");
+        if (outputStream == NULL) {
+            throw IOException(__FILE__, __LINE__, "DataOutputStream::write - Base stream is Null");
         }
 
-        buffer[0] = (unsigned char)((value & 0xFF00) >> 8);
-        buffer[1] = (unsigned char)((value & 0x00FF) >> 0);
+        buffer[0] = (unsigned char) ((value & 0xFF00) >> 8);
+        buffer[1] = (unsigned char) ((value & 0x00FF) >> 0);
 
-        outputStream->write( buffer, sizeof(value), 0, sizeof(value) );
-        written += sizeof( value );
+        outputStream->write(buffer, sizeof(value), 0, sizeof(value));
+        written += sizeof(value);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeInt( int value ) {
+void DataOutputStream::writeInt(int value) {
 
     try {
 
-        if( outputStream == NULL ) {
-            throw IOException(
-                __FILE__, __LINE__,
-                "DataOutputStream::write - Base stream is Null");
+        if (outputStream == NULL) {
+            throw IOException(__FILE__, __LINE__, "DataOutputStream::write - Base stream is Null");
         }
 
-        buffer[0] = (unsigned char)((value & 0xFF000000) >> 24);
-        buffer[1] = (unsigned char)((value & 0x00FF0000) >> 16);
-        buffer[2] = (unsigned char)((value & 0x0000FF00) >> 8);
-        buffer[3] = (unsigned char)((value & 0x000000FF) >> 0);
+        buffer[0] = (unsigned char) ((value & 0xFF000000) >> 24);
+        buffer[1] = (unsigned char) ((value & 0x00FF0000) >> 16);
+        buffer[2] = (unsigned char) ((value & 0x0000FF00) >> 8);
+        buffer[3] = (unsigned char) ((value & 0x000000FF) >> 0);
 
-        outputStream->write( buffer, sizeof(value), 0, sizeof(value) );
-        written += sizeof( value );
+        outputStream->write(buffer, sizeof(value), 0, sizeof(value));
+        written += sizeof(value);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeLong( long long value ) {
+void DataOutputStream::writeLong(long long value) {
 
     try {
 
-        if( outputStream == NULL ) {
-            throw IOException(
-                __FILE__, __LINE__,
-                "DataOutputStream::write - Base stream is Null");
+        if (outputStream == NULL) {
+            throw IOException(__FILE__, __LINE__, "DataOutputStream::write - Base stream is Null");
         }
 
-        buffer[0] = (unsigned char)((value & 0xFF00000000000000ULL) >> 56);
-        buffer[1] = (unsigned char)((value & 0x00FF000000000000ULL) >> 48);
-        buffer[2] = (unsigned char)((value & 0x0000FF0000000000ULL) >> 40);
-        buffer[3] = (unsigned char)((value & 0x000000FF00000000ULL) >> 32);
-        buffer[4] = (unsigned char)((value & 0x00000000FF000000ULL) >> 24);
-        buffer[5] = (unsigned char)((value & 0x0000000000FF0000ULL) >> 16);
-        buffer[6] = (unsigned char)((value & 0x000000000000FF00ULL) >> 8);
-        buffer[7] = (unsigned char)((value & 0x00000000000000FFULL) >> 0);
+        buffer[0] = (unsigned char) ((value & 0xFF00000000000000ULL) >> 56);
+        buffer[1] = (unsigned char) ((value & 0x00FF000000000000ULL) >> 48);
+        buffer[2] = (unsigned char) ((value & 0x0000FF0000000000ULL) >> 40);
+        buffer[3] = (unsigned char) ((value & 0x000000FF00000000ULL) >> 32);
+        buffer[4] = (unsigned char) ((value & 0x00000000FF000000ULL) >> 24);
+        buffer[5] = (unsigned char) ((value & 0x0000000000FF0000ULL) >> 16);
+        buffer[6] = (unsigned char) ((value & 0x000000000000FF00ULL) >> 8);
+        buffer[7] = (unsigned char) ((value & 0x00000000000000FFULL) >> 0);
 
-        outputStream->write( buffer, sizeof(value), 0, sizeof(value) );
-        written += sizeof( value );
+        outputStream->write(buffer, sizeof(value), 0, sizeof(value));
+        written += sizeof(value);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeFloat( float value ) {
+void DataOutputStream::writeFloat(float value) {
     try {
         unsigned int lvalue = 0;
-        memcpy( &lvalue, &value, sizeof( float ) );
-        this->writeInt( lvalue );
+        memcpy(&lvalue, &value, sizeof(float));
+        this->writeInt(lvalue);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeDouble( double value ) {
+void DataOutputStream::writeDouble(double value) {
     try {
         unsigned long long lvalue = 0;
-        memcpy( &lvalue, &value, sizeof( double ) );
-        this->writeLong( lvalue );
+        memcpy(&lvalue, &value, sizeof(double));
+        this->writeLong(lvalue);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeBytes( const std::string& value ) {
+void DataOutputStream::writeBytes(const std::string& value) {
     try {
 
-        if( value.length() == 0 ) {
+        if (value.length() == 0) {
             return;
         }
 
         // do not add one so that we don't write the NULL
-        this->write( (const unsigned char*)value.c_str(), (int)value.length(), 0, (int)value.length() );
+        this->write((const unsigned char*) value.c_str(), (int) value.length(), 0, (int) value.length());
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeChars( const std::string& value ) {
+void DataOutputStream::writeChars(const std::string& value) {
     try {
 
-        if( value.length() == 0 ) {
+        if (value.length() == 0) {
             return;
         }
 
         // add one so that we write the NULL
-        this->write( (const unsigned char*)value.c_str(), (int)value.length() + 1, 0, (int)value.length() + 1 );
+        this->write((const unsigned char*) value.c_str(), (int) value.length() + 1, 0, (int) value.length() + 1);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::writeUTF( const std::string& value ) {
+void DataOutputStream::writeUTF(const std::string& value) {
 
     try {
 
-        unsigned int utfLength = this->countUTFLength( value );
+        unsigned int utfLength = this->countUTFLength(value);
 
-        if( utfLength > 65535 ) {
-            throw UTFDataFormatException(
-                __FILE__, __LINE__,
-                "Attempted to write a string as UTF-8 whose length is longer "
-                "than the supported 65535 bytes" );
+        if (utfLength > 65535) {
+            throw UTFDataFormatException(__FILE__, __LINE__, "Attempted to write a string as UTF-8 whose length is longer "
+                    "than the supported 65535 bytes");
         }
 
         std::size_t length = value.length();
-        std::vector<unsigned char> utfBytes( (std::size_t)utfLength );
+        std::vector<unsigned char> utfBytes((std::size_t) utfLength);
         unsigned int utfIndex = 0;
 
-        for( std::size_t i = 0; i < length; i++ ) {
+        for (std::size_t i = 0; i < length; i++) {
 
-            unsigned int charValue = (unsigned char)value.at( i );
+            unsigned int charValue = (unsigned char) value.at(i);
 
             // Written to allow for expansion to wide character strings at some
             // point, as it stands now the value can never be > 255 since the
             // string class returns a single byte char.
-            if( charValue > 0 && charValue <= 127 ) {
-                utfBytes[utfIndex++] = (unsigned char)charValue;
-            } else if( charValue <= 2047 ) {
-                utfBytes[utfIndex++] = (unsigned char)(0xc0 | (0x1f & (charValue >> 6)));
-                utfBytes[utfIndex++] = (unsigned char)(0x80 | (0x3f & charValue));
+            if (charValue > 0 && charValue <= 127) {
+                utfBytes[utfIndex++] = (unsigned char) charValue;
+            } else if (charValue <= 2047) {
+                utfBytes[utfIndex++] = (unsigned char) (0xc0 | (0x1f & (charValue >> 6)));
+                utfBytes[utfIndex++] = (unsigned char) (0x80 | (0x3f & charValue));
             } else {
-                utfBytes[utfIndex++] = (unsigned char)(0xe0 | (0x0f & (charValue >> 12)));
-                utfBytes[utfIndex++] = (unsigned char)(0x80 | (0x3f & (charValue >> 6)));
-                utfBytes[utfIndex++] = (unsigned char)(0x80 | (0x3f & charValue));
+                utfBytes[utfIndex++] = (unsigned char) (0xe0 | (0x0f & (charValue >> 12)));
+                utfBytes[utfIndex++] = (unsigned char) (0x80 | (0x3f & (charValue >> 6)));
+                utfBytes[utfIndex++] = (unsigned char) (0x80 | (0x3f & charValue));
             }
         }
 
-        this->writeUnsignedShort( (unsigned short)utfLength );
-        if( utfLength > 0 ) {
-            this->write( &utfBytes[0], utfIndex, 0, utfIndex );
+        this->writeUnsignedShort((unsigned short) utfLength);
+        if (utfLength > 0) {
+            this->write(&utfBytes[0], utfIndex, 0, utfIndex);
         }
     }
-    DECAF_CATCH_RETHROW( UTFDataFormatException )
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(UTFDataFormatException)
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-unsigned int DataOutputStream::countUTFLength( const std::string& value ) {
+unsigned int DataOutputStream::countUTFLength(const std::string& value) {
 
     unsigned int utfCount = 0;
     std::size_t length = value.length();
 
-    for( std::size_t i = 0; i < length; ++i ) {
+    for (std::size_t i = 0; i < length; ++i) {
 
-        unsigned int charValue = (unsigned char)value.at( i );
+        unsigned int charValue = (unsigned char) value.at(i);
 
         // Written to allow for expansion to wide character strings at some
         // point, as it stands now the value can never be > 255 since the
         // string class returns a single byte char.
-        if( charValue > 0 && charValue <= 127 ) {
+        if (charValue > 0 && charValue <= 127) {
             utfCount++;
-        } else if( charValue <= 2047 ) {
+        } else if (charValue <= 2047) {
             utfCount += 2;
         } else {
             utfCount += 3;

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataOutputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataOutputStream.h?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataOutputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataOutputStream.h Wed Oct  3 23:10:47 2012
@@ -31,7 +31,7 @@ namespace io{
      * types to an output stream in a portable way. An application can then
      * use a data input stream to read the data back in.
      */
-    class DECAF_API DataOutputStream : public FilterOutputStream {
+    class DECAF_API DataOutputStream: public FilterOutputStream {
     protected:
 
         // The number of bytes written to the data output stream so far.
@@ -42,8 +42,8 @@ namespace io{
 
     private:
 
-        DataOutputStream( const DataOutputStream& );
-        DataOutputStream& operator= ( const DataOutputStream& );
+        DataOutputStream(const DataOutputStream&);
+        DataOutputStream& operator=(const DataOutputStream&);
 
     public:
 
@@ -53,7 +53,7 @@ namespace io{
          * @param outputStream a stream to wrap with this one.
          * @param own true if this objects owns the stream that it wraps.
          */
-        DataOutputStream( OutputStream* outputStream, bool own = false );
+        DataOutputStream(OutputStream* outputStream, bool own = false);
 
         virtual ~DataOutputStream();
 
@@ -71,73 +71,73 @@ namespace io{
         /**
          * {@inheritDoc}
          */
-        virtual void writeBoolean( bool value );
+        virtual void writeBoolean(bool value);
 
         /**
          * {@inheritDoc}
          */
-       virtual void writeByte( unsigned char value );
+        virtual void writeByte(unsigned char value);
 
         /**
          * {@inheritDoc}
          */
-        virtual void writeShort( short value );
+        virtual void writeShort(short value);
 
         /**
          * {@inheritDoc}
          */
-        virtual void writeUnsignedShort( unsigned short value );
+        virtual void writeUnsignedShort(unsigned short value);
 
         /**
          * {@inheritDoc}
          */
-        virtual void writeChar( char value );
+        virtual void writeChar(char value);
 
         /**
          * {@inheritDoc}
          */
-        virtual void writeInt( int value );
+        virtual void writeInt(int value);
 
         /**
          * {@inheritDoc}
          */
-        virtual void writeLong( long long value );
+        virtual void writeLong(long long value);
 
         /**
          * {@inheritDoc}
          */
-        virtual void writeFloat( float value );
+        virtual void writeFloat(float value);
 
         /**
          * {@inheritDoc}
          */
-        virtual void writeDouble( double value );
+        virtual void writeDouble(double value);
 
         /**
          * {@inheritDoc}
          */
-        virtual void writeBytes( const std::string& value );
+        virtual void writeBytes(const std::string& value);
 
         /**
          * {@inheritDoc}
          */
-        virtual void writeChars( const std::string& value );
+        virtual void writeChars(const std::string& value);
 
         /**
          * {@inheritDoc}
          */
-        virtual void writeUTF( const std::string& value );
+        virtual void writeUTF(const std::string& value);
 
     protected:
 
-        virtual void doWriteByte( unsigned char value );
+        virtual void doWriteByte(unsigned char value);
 
-        virtual void doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length );
+        virtual void doWriteArrayBounded(const unsigned char* buffer, int size, int offset, int length);
 
     private:
 
         // Determine the encoded length of a string when written as modified UTF-8
-        unsigned int countUTFLength( const std::string& value );
+        unsigned int countUTFLength(const std::string& value);
 
     };
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/EOFException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/EOFException.h?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/EOFException.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/EOFException.h Wed Oct  3 23:10:47 2012
@@ -26,8 +26,7 @@ namespace io{
     /*
      * Signals that an End of File exception has occurred.
      */
-    class DECAF_API EOFException : public io::IOException
-    {
+    class DECAF_API EOFException: public io::IOException {
     public:
 
         /**
@@ -39,18 +38,16 @@ namespace io{
          * Copy Constructor
          * @param ex the exception to copy
          */
-        EOFException( const lang::Exception& ex )
-        : IOException() {
-            *(lang::Exception*)this = ex;
+        EOFException(const lang::Exception& ex) : IOException() {
+            *(lang::Exception*) this = ex;
         }
 
         /**
          * Copy Constructor
          * @param ex the exception to copy, which is an instance of this type
          */
-        EOFException( const EOFException& ex )
-        : IOException() {
-            *(lang::Exception*)this = ex;
+        EOFException(const EOFException& ex) : IOException() {
+            *(lang::Exception*) this = ex;
         }
 
         /**
@@ -63,16 +60,13 @@ namespace io{
          * @param msg The message to report
          * @param ... list of primitives that are formatted into the message
          */
-        EOFException( const char* file, const int lineNumber,
-                      const std::exception* cause,
-                      const char* msg, ... ) : IOException( cause )
-        {
+        EOFException(const char* file, const int lineNumber, const std::exception* cause, const char* msg, ...) : IOException(cause) {
             va_list vargs;
-            va_start( vargs, msg );
-            buildMessage( msg, vargs );
+            va_start(vargs, msg);
+            buildMessage(msg, vargs);
 
             // Set the first mark for this exception.
-            setMark( file, lineNumber );
+            setMark(file, lineNumber);
         }
 
         /**
@@ -80,7 +74,8 @@ namespace io{
          * @param cause Pointer to the exception that caused this one to
          * be thrown, the object is cloned caller retains ownership.
          */
-        EOFException( const std::exception* cause ) : IOException( cause ) {}
+        EOFException(const std::exception* cause) : IOException(cause) {
+        }
 
         /**
          * Constructor
@@ -90,16 +85,13 @@ namespace io{
          * @param msg The message to report
          * @param ... list of primitives that are formatted into the message
          */
-        EOFException( const char* file, const int lineNumber,
-                      const char* msg, ... )
-        : IOException()
-        {
+        EOFException(const char* file, const int lineNumber, const char* msg, ...) : IOException() {
             va_list vargs;
-            va_start( vargs, msg );
-            buildMessage( msg, vargs );
+            va_start(vargs, msg);
+            buildMessage(msg, vargs);
 
             // Set the first mark for this exception.
-            setMark( file, lineNumber );
+            setMark(file, lineNumber);
         }
 
         /**
@@ -109,11 +101,11 @@ namespace io{
          *
          * @return a new instance of an Exception that is a copy of this one.
          */
-        virtual EOFException* clone() const{
-            return new EOFException( *this );
+        virtual EOFException* clone() const {
+            return new EOFException(*this);
         }
 
-        virtual ~EOFException() throw(){}
+        virtual ~EOFException() throw () {}
 
     };
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FileDescriptor.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FileDescriptor.cpp?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FileDescriptor.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FileDescriptor.cpp Wed Oct  3 23:10:47 2012
@@ -30,7 +30,7 @@ FileDescriptor::FileDescriptor() : descr
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-FileDescriptor::FileDescriptor( long value, bool readonly ) : descriptor( value ), readonly( readonly ) {
+FileDescriptor::FileDescriptor(long value, bool readonly) : descriptor(value), readonly(readonly) {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -40,7 +40,7 @@ FileDescriptor::~FileDescriptor() {
 ////////////////////////////////////////////////////////////////////////////////
 void FileDescriptor::sync() {
 
-    if( !this->readonly ) {
+    if (!this->readonly) {
         // TODO - Implement a Sync method for each OS.
     }
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FileDescriptor.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FileDescriptor.h?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FileDescriptor.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FileDescriptor.h Wed Oct  3 23:10:47 2012
@@ -57,7 +57,7 @@ namespace io {
 
     protected:
 
-        FileDescriptor( long value, bool readonly );
+        FileDescriptor(long value, bool readonly);
 
     public:
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.h?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.h Wed Oct  3 23:10:47 2012
@@ -35,7 +35,7 @@ namespace io{
      * FilterInputStream  may further override some of these methods and may
      * also provide additional methods and fields.
      */
-    class DECAF_API FilterInputStream : public InputStream {
+    class DECAF_API FilterInputStream: public InputStream {
     protected:
 
         // The input stream to wrap
@@ -49,8 +49,8 @@ namespace io{
 
     private:
 
-        FilterInputStream( const FilterInputStream& );
-        FilterInputStream& operator= ( const FilterInputStream& );
+        FilterInputStream(const FilterInputStream&);
+        FilterInputStream& operator=(const FilterInputStream&);
 
     public:
 
@@ -62,7 +62,7 @@ namespace io{
          * @param own
          *      Indicates if we own the stream object, defaults to false.
          */
-        FilterInputStream( InputStream* inputStream, bool own = false );
+        FilterInputStream(InputStream* inputStream, bool own = false);
 
         virtual ~FilterInputStream();
 
@@ -79,12 +79,12 @@ namespace io{
         /**
          * {@inheritDoc}
          */
-        virtual long long skip( long long num );
+        virtual long long skip(long long num);
 
         /**
          * {@inheritDoc}
          */
-        virtual void mark( int readLimit );
+        virtual void mark(int readLimit);
 
         /**
          * {@inheritDoc}
@@ -100,9 +100,9 @@ namespace io{
 
         virtual int doReadByte();
 
-        virtual int doReadArray( unsigned char* buffer, int size );
+        virtual int doReadArray(unsigned char* buffer, int size);
 
-        virtual int doReadArrayBounded( unsigned char* buffer, int size, int offset, int length );
+        virtual int doReadArrayBounded(unsigned char* buffer, int size, int offset, int length);
 
         /**
          * @returns true if this stream has been closed.

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.h?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.h Wed Oct  3 23:10:47 2012
@@ -46,7 +46,7 @@ namespace io{
      *
      *  DataOutputStream os = new DataOutputStream( new OutputStream(), true )
      */
-    class DECAF_API FilterOutputStream : public OutputStream {
+    class DECAF_API FilterOutputStream: public OutputStream {
     protected:
 
         // The output Stream to wrap
@@ -60,8 +60,8 @@ namespace io{
 
     private:
 
-        FilterOutputStream( const FilterOutputStream& );
-        FilterOutputStream& operator= ( const FilterOutputStream& );
+        FilterOutputStream(const FilterOutputStream&);
+        FilterOutputStream& operator=(const FilterOutputStream&);
 
     public:
 
@@ -71,7 +71,7 @@ namespace io{
          * @param own If true, this object will control the lifetime of the
          * output stream that it encapsulates.
          */
-        FilterOutputStream( OutputStream* outputStream, bool own = false );
+        FilterOutputStream(OutputStream* outputStream, bool own = false);
 
         virtual ~FilterOutputStream();
 
@@ -101,11 +101,11 @@ namespace io{
 
     protected:
 
-        virtual void doWriteByte( unsigned char value );
+        virtual void doWriteByte(unsigned char value);
 
-        virtual void doWriteArray( const unsigned char* buffer, int size );
+        virtual void doWriteArray(const unsigned char* buffer, int size);
 
-        virtual void doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length );
+        virtual void doWriteArrayBounded(const unsigned char* buffer, int size, int offset, int length);
 
     protected:
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStream.cpp?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStream.cpp Wed Oct  3 23:10:47 2012
@@ -36,65 +36,62 @@ InputStream::~InputStream() {
 
 ////////////////////////////////////////////////////////////////////////////////
 void InputStream::close() {
-    // Nothing to do by default.
+
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void InputStream::mark( int readLimit DECAF_UNUSED ) {
-    // Nothing to do by default.
+void InputStream::mark(int readLimit DECAF_UNUSED) {
+
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 std::string InputStream::toString() const {
-    return typeid( this ).name();
+    return typeid(this).name();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void InputStream::reset() {
-    throw IOException(
-        __FILE__, __LINE__,
-        "Base InputStream class does not support Reset." );
+    throw IOException(__FILE__, __LINE__, "Base InputStream class does not support Reset.");
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 int InputStream::read() {
-    try{
+    try {
         return this->doReadByte();
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int InputStream::read( unsigned char* buffer, int size ) {
+int InputStream::read(unsigned char* buffer, int size) {
 
-    try{
-        return this->doReadArray( buffer, size );
+    try {
+        return this->doReadArray(buffer, size);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCH_RETHROW( NullPointerException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCH_RETHROW(NullPointerException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int InputStream::read( unsigned char* buffer, int size,
-                       int offset, int length ) {
+int InputStream::read(unsigned char* buffer, int size, int offset, int length) {
 
-    try{
-        return this->doReadArrayBounded( buffer, size, offset, length );
+    try {
+        return this->doReadArrayBounded(buffer, size, offset, length);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
-    DECAF_CATCH_RETHROW( NullPointerException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+    DECAF_CATCH_RETHROW(NullPointerException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-long long InputStream::skip( long long num ) {
+long long InputStream::skip(long long num) {
 
-    try{
+    try {
 
-        if( num <= 0 ) {
+        if (num <= 0) {
             return 0;
         }
 
@@ -103,85 +100,82 @@ long long InputStream::skip( long long n
         // Lets not try and buffer every byte since it could be as large as
         // whatever size_t is on this platform, read the data in reasonable
         // chunks until finished.
-        int toRead = num < 4096LL ? (int)num : 4096;
-        std::vector<unsigned char> buffer( toRead );
+        int toRead = num < 4096LL ? (int) num : 4096;
+        std::vector<unsigned char> buffer(toRead);
 
-        while( skipped < num ) {
+        while (skipped < num) {
 
-            int read = doReadArrayBounded( &buffer[0], (int)buffer.size(), 0, toRead );
+            int read = doReadArrayBounded(&buffer[0], (int) buffer.size(), 0, toRead);
 
             // Is it EOF?
-            if( read == -1 ) {
+            if (read == -1) {
                 return skipped;
             }
 
             skipped += read;
 
-            if( read < toRead ) {
+            if (read < toRead) {
                 return skipped;
             }
-            if( num - skipped < toRead ) {
-                toRead = (int)( num - skipped );
+            if (num - skipped < toRead) {
+                toRead = (int) (num - skipped);
             }
         }
         return skipped;
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCH_RETHROW( UnsupportedOperationException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCH_RETHROW(UnsupportedOperationException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int InputStream::doReadArray( unsigned char* buffer, int size ) {
+int InputStream::doReadArray(unsigned char* buffer, int size) {
 
-    try{
-        return this->doReadArrayBounded( buffer, size, 0, size );
+    try {
+        return this->doReadArrayBounded(buffer, size, 0, size);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCH_RETHROW( NullPointerException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCH_RETHROW(NullPointerException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int InputStream::doReadArrayBounded( unsigned char* buffer, int size,
-                                     int offset, int length ) {
+int InputStream::doReadArrayBounded(unsigned char* buffer, int size, int offset, int length) {
 
-    try{
+    try {
 
-        if( length == 0 ) {
+        if (length == 0) {
             return 0;
         }
 
-        if( buffer == NULL ) {
-            throw NullPointerException(
-                __FILE__, __LINE__, "Buffer passed was NULL" );
+        if (buffer == NULL) {
+            throw NullPointerException(__FILE__, __LINE__, "Buffer passed was NULL");
         }
 
-        if( length > ( size - offset ) ) {
-            throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "Offset + Length given exceeds Buffer size." );
+        if (length > (size - offset)) {
+            throw IndexOutOfBoundsException(__FILE__, __LINE__, "Offset + Length given exceeds Buffer size.");
         }
 
-        for( int i = 0; i < length; i++ ) {
+        for (int i = 0; i < length; i++) {
 
             int c;
             try {
-                if( ( c = doReadByte() ) == -1 ) {
-                    return i == 0 ? -1 : (int)i;
+                if ((c = doReadByte()) == -1) {
+                    return i == 0 ? -1 : (int) i;
                 }
-            } catch( IOException& e ) {
-                if( i != 0 ) {
-                    return (int)i;
+            } catch (IOException& e) {
+                if (i != 0) {
+                    return (int) i;
                 }
                 throw e;
             }
-            buffer[offset + i] = (unsigned char)c;
+            buffer[offset + i] = (unsigned char) c;
         }
 
-        return (int)length;
+        return (int) length;
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
-    DECAF_CATCH_RETHROW( NullPointerException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+    DECAF_CATCH_RETHROW(NullPointerException)
+    DECAF_CATCHALL_THROW(IOException)
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStream.h?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStream.h Wed Oct  3 23:10:47 2012
@@ -36,8 +36,7 @@ namespace io{
      *
      * @since 1.0
      */
-    class DECAF_API InputStream : public Closeable,
-                                  virtual public util::concurrent::Synchronizable {
+    class DECAF_API InputStream: public Closeable, virtual public util::concurrent::Synchronizable {
     private:
 
         // Synchronization object.
@@ -45,8 +44,8 @@ namespace io{
 
     private:
 
-        InputStream( const InputStream& );
-        InputStream& operator= ( const InputStream& );
+        InputStream(const InputStream&);
+        InputStream& operator=(const InputStream&);
 
     public:
 
@@ -80,7 +79,7 @@ namespace io{
          * @param readLimit
          *      The max bytes read before marked position is invalid.
          */
-        virtual void mark( int readLimit );
+        virtual void mark(int readLimit);
 
         /**
          * Repositions this stream to the position at the time the mark method was
@@ -184,7 +183,7 @@ namespace io{
          * @throws IOException if an I/O error occurs.
          * @throws NullPointerException if buffer passed is NULL.
          */
-        virtual int read( unsigned char* buffer, int size );
+        virtual int read(unsigned char* buffer, int size);
 
         /**
          * Reads up to length bytes of data from the input stream into an array of bytes. An
@@ -231,7 +230,7 @@ namespace io{
          * @throws NullPointerException if buffer passed is NULL.
          * @throws IndexOutOfBoundsException if length > size - offset.
          */
-        virtual int read( unsigned char* buffer, int size, int offset, int length );
+        virtual int read(unsigned char* buffer, int size, int offset, int length);
 
         /**
          * Skips over and discards n bytes of data from this input stream. The skip
@@ -254,7 +253,7 @@ namespace io{
          * @throws UnsupportedOperationException if the concrete stream class does
          *         not support skipping bytes.
          */
-        virtual long long skip( long long num );
+        virtual long long skip(long long num);
 
         /**
          * Output a String representation of this object.
@@ -265,15 +264,15 @@ namespace io{
          */
         virtual std::string toString() const;
 
-    protected:  // Virtual doRead methods that can be overridden to customize subclasses.
+    protected: // Virtual doRead methods that can be overridden to customize subclasses.
 
         virtual int doReadByte() = 0;
 
-        virtual int doReadArray( unsigned char* buffer, int size );
+        virtual int doReadArray(unsigned char* buffer, int size);
 
-        virtual int doReadArrayBounded( unsigned char* buffer, int size, int offset, int length );
+        virtual int doReadArrayBounded(unsigned char* buffer, int size, int offset, int length);
 
-    public:  // Synchronizable
+    public: // Synchronizable
 
         virtual void lock() {
             mutex.lock();
@@ -291,12 +290,12 @@ namespace io{
             mutex.wait();
         }
 
-        virtual void wait( long long millisecs ) {
-            mutex.wait( millisecs );
+        virtual void wait(long long millisecs) {
+            mutex.wait(millisecs);
         }
 
-        virtual void wait( long long millisecs, int nanos ) {
-            mutex.wait( millisecs, nanos );
+        virtual void wait(long long millisecs, int nanos) {
+            mutex.wait(millisecs, nanos);
         }
 
         virtual void notify() {

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStreamReader.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStreamReader.cpp?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStreamReader.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStreamReader.cpp Wed Oct  3 23:10:47 2012
@@ -26,82 +26,81 @@ using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
-InputStreamReader::InputStreamReader( InputStream* stream, bool own ) :
+InputStreamReader::InputStreamReader(InputStream* stream, bool own) :
     Reader(), stream(stream), own(own), closed(false) {
 
-    if( stream == NULL ) {
-        throw NullPointerException(
-            __FILE__, __LINE__, "The passed InputStream cannot be NULL." );
+    if (stream == NULL) {
+        throw NullPointerException(__FILE__, __LINE__, "The passed InputStream cannot be NULL.");
     }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 InputStreamReader::~InputStreamReader() {
 
-    try{
-
+    try {
         this->close();
+    }
+    DECAF_CATCHALL_NOTHROW()
 
-        if( this->own ) {
+    try {
+        if (this->own) {
             delete this->stream;
         }
 
         this->stream = NULL;
     }
-    DECAF_CATCH_NOTHROW( Exception )
     DECAF_CATCHALL_NOTHROW()
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void InputStreamReader::close() {
 
-    try{
-
-        if( !closed ) {
+    try {
+        if (!closed) {
             this->stream->close();
             this->closed = true;
         }
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 bool InputStreamReader::ready() const {
 
-    try{
+    try {
         checkClosed();
-        try{
+        try {
             return this->stream->available() != 0;
-        } catch( IOException& ex ) {
+        } catch (IOException& ex) {
             return false;
         }
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int InputStreamReader::doReadArrayBounded( char* buffer, int size, int offset, int length ) {
+int InputStreamReader::doReadArrayBounded(char* buffer, int size, int offset, int length) {
 
-    try{
+    try {
         checkClosed();
 
-        if( length == 0 ) {
+        if (length == 0) {
             return 0;
         }
 
-        return this->stream->read( (unsigned char*)buffer, size, offset, length );
+        return this->stream->read((unsigned char*) buffer, size, offset, length);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCH_RETHROW( NullPointerException )
-    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCH_RETHROW(NullPointerException)
+    DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void InputStreamReader::checkClosed() const {
-    if( closed ) {
-        throw IOException( __FILE__, __LINE__, "This Reader is Closed" );
+    if (closed) {
+        throw IOException(__FILE__, __LINE__, "This Reader is Closed");
     }
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStreamReader.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStreamReader.h?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStreamReader.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStreamReader.h Wed Oct  3 23:10:47 2012
@@ -39,7 +39,7 @@ namespace io {
      *
      * @since 1.0
      */
-    class DECAF_API InputStreamReader : public Reader {
+    class DECAF_API InputStreamReader: public Reader {
     private:
 
         // The target InputStream
@@ -53,8 +53,8 @@ namespace io {
 
     private:
 
-        InputStreamReader( const InputStreamReader& );
-        InputStreamReader& operator= ( const InputStreamReader& );
+        InputStreamReader(const InputStreamReader&);
+        InputStreamReader& operator=(const InputStreamReader&);
 
     public:
 
@@ -68,7 +68,7 @@ namespace io {
          *
          * @throw NullPointerException if the passed InputStream is NULL.
          */
-        InputStreamReader( InputStream* stream, bool own = false );
+        InputStreamReader(InputStream* stream, bool own = false);
 
         virtual ~InputStreamReader();
 
@@ -78,7 +78,7 @@ namespace io {
 
     protected:
 
-        virtual int doReadArrayBounded( char* buffer, int size, int offset, int length );
+        virtual int doReadArrayBounded(char* buffer, int size, int offset, int length);
 
         virtual void checkClosed() const;
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStream.cpp?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStream.cpp Wed Oct  3 23:10:47 2012
@@ -37,94 +37,87 @@ OutputStream::~OutputStream() {
 
 ////////////////////////////////////////////////////////////////////////////////
 void OutputStream::close() {
-    // Nothing to do by default.
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void OutputStream::flush() {
-    // Nothing to do by default.
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 std::string OutputStream::toString() const {
-    return typeid( this ).name();
+    return typeid(this).name();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void OutputStream::write( unsigned char c ) {
+void OutputStream::write(unsigned char c) {
 
-    try{
-        this->doWriteByte( c );
+    try {
+        this->doWriteByte(c);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void OutputStream::write( const unsigned char* buffer, int size ) {
+void OutputStream::write(const unsigned char* buffer, int size) {
 
-    try{
-        this->doWriteArray( buffer, size );
+    try {
+        this->doWriteArray(buffer, size);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCH_RETHROW( NullPointerException )
-    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCH_RETHROW(NullPointerException)
+    DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void OutputStream::write( const unsigned char* buffer, int size, int offset, int length ) {
+void OutputStream::write(const unsigned char* buffer, int size, int offset, int length) {
 
-    try{
-        this->doWriteArrayBounded( buffer, size, offset, length );
+    try {
+        this->doWriteArrayBounded(buffer, size, offset, length);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCH_RETHROW( NullPointerException )
-    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCH_RETHROW(NullPointerException)
+    DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void OutputStream::doWriteArray( const unsigned char* buffer, int size ) {
+void OutputStream::doWriteArray(const unsigned char* buffer, int size) {
 
-    try{
-        this->doWriteArrayBounded( buffer, size, 0, size );
+    try {
+        this->doWriteArrayBounded(buffer, size, 0, size);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void OutputStream::doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length ) {
+void OutputStream::doWriteArrayBounded(const unsigned char* buffer, int size, int offset, int length) {
 
-    try{
-
-        if( buffer == NULL ) {
-            throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "Buffer pointer passed was NULL." );
-        }
+    if (buffer == NULL) {
+        throw IndexOutOfBoundsException(__FILE__, __LINE__, "Buffer pointer passed was NULL.");
+    }
 
-        if( size < 0 ) {
-            throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "size parameter out of Bounds: %d.", size );
-        }
+    if (size < 0) {
+        throw IndexOutOfBoundsException(__FILE__, __LINE__, "size parameter out of Bounds: %d.", size);
+    }
 
-        if( offset > size || offset < 0 ) {
-            throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "offset parameter out of Bounds: %d.", offset );
-        }
+    if (offset > size || offset < 0) {
+        throw IndexOutOfBoundsException(__FILE__, __LINE__, "offset parameter out of Bounds: %d.", offset);
+    }
 
-        if( length < 0 || length > size - offset ) {
-            throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
-        }
+    if (length < 0 || length > size - offset) {
+        throw IndexOutOfBoundsException(__FILE__, __LINE__, "length parameter out of Bounds: %d.", length);
+    }
 
-        for( int i = offset; i < offset + length; i++ ) {
-            this->doWriteByte( buffer[i] );
+    try {
+        for (int i = offset; i < offset + length; i++) {
+            this->doWriteByte(buffer[i]);
         }
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCH_RETHROW( NullPointerException )
-    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCH_RETHROW(NullPointerException)
+    DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+    DECAF_CATCHALL_THROW(IOException)
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStream.h?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStream.h Wed Oct  3 23:10:47 2012
@@ -36,10 +36,7 @@ namespace io{
      *
      * @since 1.0
      */
-    class DECAF_API OutputStream : public Closeable,
-                                   public Flushable,
-                                   public util::concurrent::Synchronizable
-    {
+    class DECAF_API OutputStream: public Closeable, public Flushable, public util::concurrent::Synchronizable {
     private:
 
         // Synchronization object.
@@ -47,8 +44,8 @@ namespace io{
 
     private:
 
-        OutputStream( const OutputStream& );
-        OutputStream& operator= ( const OutputStream& );
+        OutputStream(const OutputStream&);
+        OutputStream& operator=(const OutputStream&);
 
     public:
 
@@ -81,7 +78,7 @@ namespace io{
          *
          * @throws IOException if an I/O error occurs.
          */
-        virtual void write( unsigned char c );
+        virtual void write(unsigned char c);
 
         /**
          * Writes an array of bytes to the output stream.  The entire contents of
@@ -101,7 +98,7 @@ namespace io{
          * @throws NullPointerException thrown if buffer is Null.
          * @throws IndexOutOfBoundsException if size value is negative.
          */
-        virtual void write( const unsigned char* buffer, int size );
+        virtual void write(const unsigned char* buffer, int size);
 
         /**
          * Writes an array of bytes to the output stream in order starting at buffer[offset]
@@ -127,7 +124,7 @@ namespace io{
          * @throws IndexOutOfBoundsException if the offset + length > size. or one of the
          *         parameters is negative.
          */
-        virtual void write( const unsigned char* buffer, int size, int offset, int length );
+        virtual void write(const unsigned char* buffer, int size, int offset, int length);
 
         /**
          * Output a String representation of this object.
@@ -140,13 +137,13 @@ namespace io{
 
     protected:
 
-        virtual void doWriteByte( unsigned char value ) = 0;
+        virtual void doWriteByte(unsigned char value) = 0;
 
-        virtual void doWriteArray( const unsigned char* buffer, int size );
+        virtual void doWriteArray(const unsigned char* buffer, int size);
 
-        virtual void doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length );
+        virtual void doWriteArrayBounded(const unsigned char* buffer, int size, int offset, int length);
 
-    public:  // Synchronizable
+    public:
 
         virtual void lock() {
             mutex.lock();
@@ -164,12 +161,12 @@ namespace io{
             mutex.wait();
         }
 
-        virtual void wait( long long millisecs ) {
-            mutex.wait( millisecs );
+        virtual void wait(long long millisecs) {
+            mutex.wait(millisecs);
         }
 
-        virtual void wait( long long millisecs, int nanos ) {
-            mutex.wait( millisecs, nanos );
+        virtual void wait(long long millisecs, int nanos) {
+            mutex.wait(millisecs, nanos);
         }
 
         virtual void notify() {

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStreamWriter.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStreamWriter.cpp?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStreamWriter.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStreamWriter.cpp Wed Oct  3 23:10:47 2012
@@ -26,79 +26,77 @@ using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
-OutputStreamWriter::OutputStreamWriter( OutputStream* stream, bool own ) : stream(stream),
-                                                                           own(own),
-                                                                           closed(false) {
-
-    if( stream == NULL ) {
-        throw NullPointerException(
-            __FILE__, __LINE__, "OutputStream pointer cannot be NULL" );
+OutputStreamWriter::OutputStreamWriter(OutputStream* stream, bool own) :
+    stream(stream), own(own), closed(false) {
+
+    if (stream == NULL) {
+        throw NullPointerException(__FILE__, __LINE__, "OutputStream pointer cannot be NULL");
     }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 OutputStreamWriter::~OutputStreamWriter() {
 
-    try{
-
+    try {
         this->close();
+    }
+    DECAF_CATCHALL_NOTHROW()
 
-        if( this->own ) {
+    try {
+        if (this->own) {
             delete this->stream;
         }
 
         this->stream = NULL;
     }
-    DECAF_CATCH_NOTHROW( Exception )
     DECAF_CATCHALL_NOTHROW()
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void OutputStreamWriter::close() {
 
-    try{
+    try {
 
-        if( !closed ) {
+        if (!closed) {
             this->stream->close();
             this->closed = true;
         }
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void OutputStreamWriter::flush() {
 
-    try{
+    try {
         checkClosed();
         this->stream->flush();
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void OutputStreamWriter::doWriteArrayBounded( const char* buffer, int size, int offset, int length ) {
+void OutputStreamWriter::doWriteArrayBounded(const char* buffer, int size, int offset, int length) {
 
-    try{
+    try {
         checkClosed();
 
-        if( buffer == NULL ) {
-            throw NullPointerException(
-                __FILE__, __LINE__, "Given buffer was NULL." );
+        if (buffer == NULL) {
+            throw NullPointerException(__FILE__, __LINE__, "Given buffer was NULL.");
         }
 
-        this->stream->write( (const unsigned char*)buffer, size, offset, length );
+        this->stream->write((const unsigned char*) buffer, size, offset, length);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCH_RETHROW( NullPointerException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCH_RETHROW(NullPointerException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void OutputStreamWriter::checkClosed() const {
-    if( closed ) {
-        throw IOException( __FILE__, __LINE__, "This Writer is Closed" );
+    if (closed) {
+        throw IOException(__FILE__, __LINE__, "This Writer is Closed");
     }
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStreamWriter.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStreamWriter.h?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStreamWriter.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/OutputStreamWriter.h Wed Oct  3 23:10:47 2012
@@ -33,7 +33,7 @@ namespace io {
      *
      * @since 1.0
      */
-    class DECAF_API OutputStreamWriter : public Writer {
+    class DECAF_API OutputStreamWriter: public Writer {
     private:
 
         // Pointer to the Stream this Writer writes its data to.
@@ -47,8 +47,8 @@ namespace io {
 
     private:
 
-        OutputStreamWriter( const OutputStreamWriter& );
-        OutputStreamWriter& operator= ( const OutputStreamWriter& );
+        OutputStreamWriter(const OutputStreamWriter&);
+        OutputStreamWriter& operator=(const OutputStreamWriter&);
 
     public:
 
@@ -63,7 +63,7 @@ namespace io {
          *
          * @throws NullPointerException if the stream is NULL.
          */
-        OutputStreamWriter( OutputStream* stream, bool own = false );
+        OutputStreamWriter(OutputStream* stream, bool own = false);
 
         virtual ~OutputStreamWriter();
 
@@ -73,7 +73,7 @@ namespace io {
 
     protected:
 
-        virtual void doWriteArrayBounded( const char* buffer, int size, int offset, int length );
+        virtual void doWriteArrayBounded(const char* buffer, int size, int offset, int length);
 
         // Used to check state and throw error when closed.
         virtual void checkClosed() const;

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/PushbackInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/PushbackInputStream.cpp?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/PushbackInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/PushbackInputStream.cpp Wed Oct  3 23:10:47 2012
@@ -25,18 +25,16 @@ using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
-PushbackInputStream::PushbackInputStream( InputStream* stream, bool own )
- :  FilterInputStream( stream, own ), buffer( new unsigned char[1] ), bufferSize( 1 ), pos( 1 ) {
-
+PushbackInputStream::PushbackInputStream(InputStream* stream, bool own) :
+    FilterInputStream(stream, own), buffer(new unsigned char[1]), bufferSize(1), pos(1) {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-PushbackInputStream::PushbackInputStream( InputStream* stream, int bufSize, bool own )
- :  FilterInputStream( stream, own ), buffer( NULL ), bufferSize( bufSize ), pos( bufSize ) {
+PushbackInputStream::PushbackInputStream(InputStream* stream, int bufSize, bool own) :
+    FilterInputStream(stream, own), buffer(NULL), bufferSize(bufSize), pos(bufSize) {
 
-    if( bufSize < 0 ) {
-        throw IllegalArgumentException(
-            __FILE__, __LINE__, "Size of Push Back buffer cannot be negative." );
+    if (bufSize < 0) {
+        throw IllegalArgumentException(__FILE__, __LINE__, "Size of Push Back buffer cannot be negative.");
     }
 
     this->buffer = new unsigned char[bufSize];
@@ -44,198 +42,178 @@ PushbackInputStream::PushbackInputStream
 
 ////////////////////////////////////////////////////////////////////////////////
 PushbackInputStream::~PushbackInputStream() {
-    try{
-
+    try {
         close();
-        delete [] this->buffer;
     }
-    DECAF_CATCH_NOTHROW( Exception )
+    DECAF_CATCHALL_NOTHROW()
+
+    try {
+        delete[] this->buffer;
+    }
     DECAF_CATCHALL_NOTHROW()
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 int PushbackInputStream::available() const {
-
-    try{
-        return ( this->bufferSize - this->pos ) + inputStream->available();
+    try {
+        return (this->bufferSize - this->pos) + inputStream->available();
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-long long PushbackInputStream::skip( long long num ) {
+long long PushbackInputStream::skip(long long num) {
 
-    try{
+    if (num <= 0) {
+        return 0;
+    }
 
-        if( num <= 0 ) {
-            return 0;
-        }
+    if (isClosed()) {
+        throw IOException(__FILE__, __LINE__, "Stream is closed");
+    }
 
-        if( isClosed() ) {
-            throw IOException(
-                __FILE__, __LINE__, "Stream is closed" );
-        }
+    try {
 
         long long unread = bufferSize - pos;
         long long numSkipped = 0;
 
-        if( unread != 0 ) {
-            numSkipped += ( num < unread ) ? num : unread;
-            pos += (int)numSkipped;
+        if (unread != 0) {
+            numSkipped += (num < unread) ? num : unread;
+            pos += (int) numSkipped;
         }
 
-        if( numSkipped < num ) {
-            numSkipped += inputStream->skip( num - numSkipped );
+        if (numSkipped < num) {
+            numSkipped += inputStream->skip(num - numSkipped);
         }
 
         return numSkipped;
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void PushbackInputStream::mark( int readLimit DECAF_UNUSED ) {
-    // Nothing to do here.
+void PushbackInputStream::mark(int readLimit DECAF_UNUSED) {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void PushbackInputStream::reset() {
-    throw IOException(
-        __FILE__, __LINE__, "Reset is not Supported by the PushbackInputStream." );
+    throw IOException(__FILE__, __LINE__, "Reset is not Supported by the PushbackInputStream.");
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void PushbackInputStream::unread( unsigned char value ) {
-
-    try{
+void PushbackInputStream::unread(unsigned char value) {
 
-        if( pos == 0 ) {
-            throw IOException(
-                __FILE__, __LINE__, "No Space left in the unread buffer." );
-        }
+    if (pos == 0) {
+        throw IOException(__FILE__, __LINE__, "No Space left in the unread buffer.");
+    }
 
+    try {
         buffer[--pos] = value;
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void PushbackInputStream::unread( const unsigned char* buffer, int size ) {
-
-    try{
+void PushbackInputStream::unread(const unsigned char* buffer, int size) {
 
-        if( size < 0 ) {
-            throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "Given size of the buffer was negatiev." );
-        }
+    if (size < 0) {
+        throw IndexOutOfBoundsException(__FILE__, __LINE__, "Given size of the buffer was negatiev.");
+    }
 
-        this->unread( buffer, size, 0, size );
+    try {
+        this->unread(buffer, size, 0, size);
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCH_RETHROW( NullPointerException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCH_RETHROW(NullPointerException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void PushbackInputStream::unread( const unsigned char* buffer, int size, int offset, int length ) {
+void PushbackInputStream::unread(const unsigned char* buffer, int size, int offset, int length) {
 
-    try{
-
-        if( length > pos ) {
-            throw IOException(
-                __FILE__, __LINE__, "No Space left in the unread buffer." );
-        }
+    if (length > pos) {
+        throw IOException(__FILE__, __LINE__, "No Space left in the unread buffer.");
+    }
 
-        if( size < 0 ) {
-            throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "size parameter out of Bounds: %d.", size );
-        }
+    if (size < 0) {
+        throw IndexOutOfBoundsException(__FILE__, __LINE__, "size parameter out of Bounds: %d.", size);
+    }
 
-        if( offset > size || offset < 0 ) {
-            throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "offset parameter out of Bounds: %d.", offset );
-        }
+    if (offset > size || offset < 0) {
+        throw IndexOutOfBoundsException(__FILE__, __LINE__, "offset parameter out of Bounds: %d.", offset);
+    }
 
-        if( length < 0 || length > size - offset ) {
-            throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
-        }
+    if (length < 0 || length > size - offset) {
+        throw IndexOutOfBoundsException(__FILE__, __LINE__, "length parameter out of Bounds: %d.", length);
+    }
 
-        if( buffer == NULL ) {
-            throw NullPointerException(
-                __FILE__, __LINE__, "Buffer pointer passed was NULL." );
-        }
+    if (buffer == NULL) {
+        throw NullPointerException(__FILE__, __LINE__, "Buffer pointer passed was NULL.");
+    }
 
-        System::arraycopy( buffer, offset, this->buffer, pos - length, length );
+    try {
+        System::arraycopy(buffer, offset, this->buffer, pos - length, length);
         pos = pos - length;
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
-    DECAF_CATCH_RETHROW( NullPointerException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+    DECAF_CATCH_RETHROW(NullPointerException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 int PushbackInputStream::doReadByte() {
 
-    try{
-
-        if( isClosed() ) {
-            throw IOException(
-                __FILE__, __LINE__, "Stream is closed" );
-        }
+    if (isClosed()) {
+        throw IOException(__FILE__, __LINE__, "Stream is closed");
+    }
 
-        if( pos < bufferSize ) {
+    try {
+        if (pos < bufferSize) {
             return buffer[pos++];
         }
 
         return inputStream->read();
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCHALL_THROW(IOException)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int PushbackInputStream::doReadArrayBounded( unsigned char* buffer, int size, int offset, int length ) {
-
-    try{
+int PushbackInputStream::doReadArrayBounded(unsigned char* buffer, int size, int offset, int length) {
 
-        if( isClosed() ) {
-            throw IOException(
-                __FILE__, __LINE__, "Stream is closed" );
-        }
+    if (isClosed()) {
+        throw IOException(__FILE__, __LINE__, "Stream is closed");
+    }
 
-        if( buffer == NULL ) {
-            throw NullPointerException(
-                __FILE__, __LINE__, "Buffer pointer passed was NULL." );
-        }
+    if (buffer == NULL) {
+        throw NullPointerException(__FILE__, __LINE__, "Buffer pointer passed was NULL.");
+    }
 
-        if( size < 0 ) {
-            throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "size parameter out of Bounds: %d.", size );
-        }
+    if (size < 0) {
+        throw IndexOutOfBoundsException(__FILE__, __LINE__, "size parameter out of Bounds: %d.", size);
+    }
 
-        if( offset > size || offset < 0 ) {
-            throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "offset parameter out of Bounds: %d.", offset );
-        }
+    if (offset > size || offset < 0) {
+        throw IndexOutOfBoundsException(__FILE__, __LINE__, "offset parameter out of Bounds: %d.", offset);
+    }
 
-        if( length < 0 || length > size - offset ) {
-            throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
-        }
+    if (length < 0 || length > size - offset) {
+        throw IndexOutOfBoundsException(__FILE__, __LINE__, "length parameter out of Bounds: %d.", length);
+    }
 
+    try {
         int copiedBytes = 0;
         int copyLength = 0;
         int newOffset = offset;
 
         // Are there pushback bytes available?
-        if( pos < bufferSize ) {
-            copyLength = ( bufferSize - pos >= length ) ? length : bufferSize - pos;
-            System::arraycopy( this->buffer, pos, buffer, newOffset, copyLength );
+        if (pos < bufferSize) {
+            copyLength = (bufferSize - pos >= length) ? length : bufferSize - pos;
+            System::arraycopy(this->buffer, pos, buffer, newOffset, copyLength);
             newOffset += copyLength;
             copiedBytes += copyLength;
             // Use up the bytes in the local buffer
@@ -243,23 +221,23 @@ int PushbackInputStream::doReadArrayBoun
         }
 
         // Have we copied enough?
-        if( copyLength == length ) {
+        if (copyLength == length) {
             return length;
         }
 
-        int inCopied = inputStream->read( buffer, size, newOffset, length - copiedBytes );
-        if( inCopied > 0 ) {
+        int inCopied = inputStream->read(buffer, size, newOffset, length - copiedBytes);
+        if (inCopied > 0) {
             return inCopied + copiedBytes;
         }
 
-        if( copiedBytes == 0 ) {
+        if (copiedBytes == 0) {
             return inCopied;
         }
 
         return copiedBytes;
     }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
-    DECAF_CATCH_RETHROW( NullPointerException )
-    DECAF_CATCHALL_THROW( IOException )
+    DECAF_CATCH_RETHROW(IOException)
+    DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+    DECAF_CATCH_RETHROW(NullPointerException)
+    DECAF_CATCHALL_THROW(IOException)
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/PushbackInputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/PushbackInputStream.h?rev=1393808&r1=1393807&r2=1393808&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/PushbackInputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/PushbackInputStream.h Wed Oct  3 23:10:47 2012
@@ -39,7 +39,7 @@ namespace io {
      *
      * @since 1.0
      */
-    class PushbackInputStream : public FilterInputStream {
+    class PushbackInputStream: public FilterInputStream {
     private:
 
         unsigned char* buffer;
@@ -48,8 +48,8 @@ namespace io {
 
     private:
 
-        PushbackInputStream( const PushbackInputStream& );
-        PushbackInputStream& operator= ( const PushbackInputStream& );
+        PushbackInputStream(const PushbackInputStream&);
+        PushbackInputStream& operator=(const PushbackInputStream&);
 
     public:
 
@@ -62,7 +62,7 @@ namespace io {
          * @param
          *      Boolean value indicating if this FilterInputStream owns the wrapped stream.
          */
-        PushbackInputStream( InputStream* stream, bool own = false );
+        PushbackInputStream(InputStream* stream, bool own = false);
 
         /**
          * Creates a PushbackInputStream  and saves its argument, the input stream in, for later
@@ -77,7 +77,7 @@ namespace io {
          *
          * @throws IllegalArgumentException if the bufSize argument is < zero.
          */
-        PushbackInputStream( InputStream* stream, int bufSize, bool own = false );
+        PushbackInputStream(InputStream* stream, int bufSize, bool own = false);
 
         virtual ~PushbackInputStream();
 
@@ -91,7 +91,7 @@ namespace io {
          * @throws IOException if there is not enough space in the pushback buffer or this stream
          *         has already been closed.
          */
-        void unread( unsigned char value );
+        void unread(unsigned char value);
 
         /**
          * Pushes back the given array of bytes, the bytes are copied to the front of the pushback
@@ -107,7 +107,7 @@ namespace io {
          * @throws IOException if there is not enough space in the pushback buffer or this stream
          *         has already been closed.
          */
-        void unread( const unsigned char* buffer, int size );
+        void unread(const unsigned char* buffer, int size);
 
         /**
          * Pushes back the given array of bytes, the bytes are copied to the front of the pushback
@@ -127,7 +127,7 @@ namespace io {
          * @throws IOException if there is not enough space in the pushback buffer or this stream
          *         has already been closed.
          */
-        void unread( const unsigned char* buffer, int size, int offset, int length );
+        void unread(const unsigned char* buffer, int size, int offset, int length);
 
         /**
          * {@inheritDoc}
@@ -144,14 +144,14 @@ namespace io {
          * complete the request by calling the underlying stream skip method with the remainder
          * of bytes that needs to be skipped.
          */
-        virtual long long skip( long long num );
+        virtual long long skip(long long num);
 
         /**
          * Does nothing except throw an IOException.
          *
          * {@inheritDoc}
          */
-        virtual void mark( int readLimit );
+        virtual void mark(int readLimit);
 
         /**
          * Does nothing except throw an IOException.
@@ -173,7 +173,7 @@ namespace io {
 
         virtual int doReadByte();
 
-        virtual int doReadArrayBounded( unsigned char* buffer, int size, int offset, int length );
+        virtual int doReadArrayBounded(unsigned char* buffer, int size, int offset, int length);
 
     };