activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r925692 [6/14] - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/ main/activemq/commands/ main/activemq/io/ main/activemq/wireformat/openwire/ main/activemq/wireformat/openwire/marshal/ main/decaf/internal/io/ main/decaf/internal/nio...
Date Sat, 20 Mar 2010 21:57:24 GMT
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayInputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayInputStream.h?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayInputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayInputStream.h Sat Mar 20 21:57:20 2010
@@ -58,25 +58,32 @@ namespace io{
 
     public:
 
-        /**
-         * Default Constructor
-         */
         ByteArrayInputStream();
 
         /**
          * Creates the input stream and calls setBuffer with the
          * specified buffer object.
-         * @param buffer The buffer to be used.
+         *
+         * @param buffer
+         *      The buffer to be used.
          */
         ByteArrayInputStream( const std::vector<unsigned char>& buffer );
 
         /**
-         * Constructor
-         * @param buffer initial byte array to use to read from
-         * @param bufferSize the size of the buffer
+         * Create an instance of the ByteArrayInputStream with the given buffer as
+         * the source of input for all read operations.
+         *
+         * @param buffer
+         *      The initial byte array to use to read from.
+         * @param bufferSize
+         *      The size of the buffer.
+         *
+         * @throws NullPointerException if the buffer is Null.
+         * @throws IllegalArguementException if the bufferSize is negative.
          */
-        ByteArrayInputStream( const unsigned char* buffer,
-                              std::size_t bufferSize );
+        ByteArrayInputStream( const unsigned char* buffer, int bufferSize )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IllegalArgumentException );
 
         virtual ~ByteArrayInputStream();
 
@@ -87,68 +94,51 @@ namespace io{
          * buffer.  This class will not own the given buffer - it is the
          * caller's responsibility to free the memory of the given buffer
          * as appropriate.
-         * @param buffer The buffer to be used.
+         *
+         * @param buffer
+         *      The buffer to be used.
          */
         virtual void setBuffer( const std::vector<unsigned char>& buffer );
 
         /**
          * Sets the data that this reader uses, replaces any existing
          * data and resets to beginning of the buffer.
-         * @param buffer initial byte array to use to read from
-         * @param bufferSize the size of the buffer
+         *
+         * @param buffer
+         *      The initial byte array to use to read from.
+         * @param bufferSize
+         *      The size of the buffer.
+         *
+         * @throws NullPointerException if the buffer is Null.
+         * @throws IllegalArguementException if the bufferSize is negative.
+         */
+        virtual void setByteArray( const unsigned char* buffer, int bufferSize )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IllegalArgumentException );
+
+        /**
+         * {@inheritDoc}
          */
-        virtual void setByteArray( const unsigned char* buffer,
-                                   std::size_t bufferSize );
+        virtual int available() const throw ( IOException );
 
         /**
-         * Indicates the number of bytes available.
-         * @return The number of bytes until the end of the internal buffer.
-         */
-        virtual std::size_t available() const throw ( IOException );
-
-        /**
-         * Skips over and discards n bytes of data from this input stream. The
-         * skip method may, for a variety of reasons, end up skipping over some
-         * smaller number of bytes, possibly 0. This may result from any of a
-         * number of conditions; reaching end of file before n bytes have been
-         * skipped is only one possibility. The actual number of bytes skipped
-         * is returned. If n is negative, no bytes are skipped.
-         * <p>
-         * The skip method of InputStream creates a byte array and then
-         * repeatedly reads into it until n bytes have been read or the end
-         * of the stream has been reached. Subclasses are encouraged to
-         * provide a more efficient implementation of this method.
-         * @param num - the number of bytes to skip
-         * @returns total butes skipped
-         * @throws IOException if an error occurs
+         * {@inheritDoc}
          */
-        virtual std::size_t skip( std::size_t num )
+        virtual long long skip( long long num )
             throw ( io::IOException, lang::exceptions::UnsupportedOperationException );
 
         /**
-         * Marks the current position in the stream A subsequent call to the
-         * reset method repositions this stream at the last marked position so
-         * that subsequent reads re-read the same bytes.
-         *
-         * If a stream instance reports that marks are supported then the stream
-         * will ensure that the same bytes can be read again after the reset method
-         * is called so long the readLimit is not reached.
-         * @param readLimit - max bytes read before marked position is invalid.
+         * {@inheritDoc}
          */
         virtual void mark( int readLimit );
 
         /**
-         * Resets the read index to the beginning of the byte array, unless mark
-         * has been called and the markLimit has not been exceeded, in which case
-         * the stream is reset to the marked position.
+         * {@inheritDoc}
          */
         virtual void reset() throw ( IOException );
 
         /**
-         * Determines if this input stream supports the mark and reset methods.
-         * Whether or not mark and reset are supported is an invariant property of
-         * a particular input stream instance.
-         * @returns true if this stream instance supports marks
+         * {@inheritDoc}
          */
         virtual bool markSupported() const{ return true; }
 
@@ -156,8 +146,7 @@ namespace io{
 
         virtual int doReadByte() throw ( IOException );
 
-        virtual int doReadArrayBounded( unsigned char* buffer, std::size_t size,
-                                        std::size_t offset, std::size_t length )
+        virtual int doReadArrayBounded( unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::IndexOutOfBoundsException,
                     decaf::lang::exceptions::NullPointerException );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.cpp Sat Mar 20 21:57:20 2010
@@ -61,7 +61,7 @@ const std::vector<unsigned char>& ByteAr
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::size_t ByteArrayOutputStream::size() const {
+long long ByteArrayOutputStream::size() const {
     return activeBuffer->size();
 }
 
@@ -83,8 +83,7 @@ void ByteArrayOutputStream::doWriteByte(
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ByteArrayOutputStream::doWriteArrayBounded( const unsigned char* buffer, std::size_t size,
-                                                 std::size_t offset, std::size_t length )
+void ByteArrayOutputStream::doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::NullPointerException,
             decaf::lang::exceptions::IndexOutOfBoundsException ) {
@@ -95,20 +94,30 @@ void ByteArrayOutputStream::doWriteArray
 
     if( buffer == NULL ) {
         throw NullPointerException(
-            __FILE__, __LINE__,
-            "ByteArrayOutputStream::write - passed buffer is null" );
+            __FILE__, __LINE__, "passed buffer is null" );
     }
 
-    if( ( offset + length ) > size ) {
-        throw decaf::lang::exceptions::IndexOutOfBoundsException(
-            __FILE__, __LINE__,
-            "ByteArrayOutputStream::write - given offset + length is greater than buffer 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( length < 0 || length > size - offset ) {
+        throw IndexOutOfBoundsException(
+            __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
     }
 
     try{
         activeBuffer->insert( activeBuffer->end(), buffer + offset, buffer + offset + length );
     }
     DECAF_CATCH_RETHROW( IOException )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
+    DECAF_CATCH_RETHROW( NullPointerException )
     DECAF_CATCHALL_THROW( IOException )
 }
 
@@ -134,8 +143,7 @@ void ByteArrayOutputStream::writeTo( Out
 
         if( out == NULL ) {
             throw NullPointerException(
-                __FILE__, __LINE__,
-                "ByteArrayOutputStream::writeTo - Passed stream pointer is null" );
+                __FILE__, __LINE__, "Passed stream pointer is null" );
         }
 
         out->write( this->toByteArray(), this->size() );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.h?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayOutputStream.h Sat Mar 20 21:57:20 2010
@@ -77,7 +77,7 @@ namespace io{
          * Get the Size of the Internal Buffer
          * @return size of the internal buffer
          */
-        virtual std::size_t size() const;
+        virtual long long size() const;
 
         /**
          * Clear current Stream contents
@@ -104,8 +104,7 @@ namespace io{
         virtual void doWriteByte( unsigned char value )
            throw ( decaf::io::IOException );
 
-        virtual void doWriteArrayBounded( const unsigned char* buffer, std::size_t size,
-                                          std::size_t offset, std::size_t length )
+        virtual void doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::NullPointerException,
                     decaf::lang::exceptions::IndexOutOfBoundsException );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInput.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInput.h?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInput.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInput.h Sat Mar 20 21:57:20 2010
@@ -279,9 +279,12 @@ namespace io {
          *
          * @throws IOException if an I/O Error occurs.
          * @throws EOFException if the end of input is reached.
+         * @throws IndexOutOfBoundsException if the size value is negative.
          */
-        virtual void readFully( unsigned char* buffer, std::size_t size )
-            throw( decaf::io::IOException, decaf::io::EOFException ) = 0;
+        virtual void readFully( unsigned char* buffer, int size )
+            throw( decaf::io::IOException,
+                   decaf::io::EOFException,
+                   decaf::lang::exceptions::IndexOutOfBoundsException ) = 0;
 
         /**
          * Reads length bytes from an input stream.
@@ -312,10 +315,9 @@ namespace io {
          * @throws IOException if an I/O Error occurs.
          * @throws EOFException if the end of input is reached.
          * @throws NullPointerException if the buffer is NULL.
-         * @throws IndexOutOfBoundsException if the offset + length > size.
+         * @throws IndexOutOfBoundsException if the offset + length > size, or an int param is negative.
          */
-        virtual void readFully( unsigned char* buffer, std::size_t size,
-                                std::size_t offset, std::size_t length )
+        virtual void readFully( unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::io::EOFException,
                     decaf::lang::exceptions::NullPointerException,
@@ -336,7 +338,7 @@ namespace io {
          *
          * @throws IOException if an I/O Error occurs.
          */
-        virtual std::size_t skipBytes( std::size_t num ) throw( io::IOException ) = 0;
+        virtual long long skipBytes( long long num ) throw( io::IOException ) = 0;
 
     };
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.cpp Sat Mar 20 21:57:20 2010
@@ -325,15 +325,20 @@ std::string DataInputStream::readUTF()
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataInputStream::readFully( unsigned char* buffer, std::size_t size )
-    throw ( decaf::io::IOException, decaf::io::EOFException ) {
+void DataInputStream::readFully( unsigned char* buffer, int size )
+    throw ( decaf::io::IOException,
+            decaf::io::EOFException,
+            decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try {
+
         if( size == 0 ) {
             return;
         }
+
         this->readFully( buffer, size, 0, size );
     }
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
     DECAF_CATCH_RETHROW( EOFException )
     DECAF_CATCH_RETHROW( IOException )
     DECAF_CATCHALL_THROW( IOException )
@@ -384,13 +389,12 @@ std::string DataInputStream::readLine() 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataInputStream::readFully( unsigned char* buffer, std::size_t size,
-                                 std::size_t offset, std::size_t length )
+void DataInputStream::readFully( unsigned char* buffer, int size, int offset, int length )
     throw ( decaf::io::IOException,
             decaf::io::EOFException,
             decaf::lang::exceptions::IndexOutOfBoundsException,
-            decaf::lang::exceptions::NullPointerException )
-{
+            decaf::lang::exceptions::NullPointerException ) {
+
     try {
 
         if( length == 0 ) {
@@ -399,40 +403,48 @@ void DataInputStream::readFully( unsigne
 
         if( buffer == NULL ) {
             throw NullPointerException(
-                __FILE__, __LINE__,
-                "DataInputStream::readFully - Buffer is null" );
+                __FILE__, __LINE__, "Buffer is null" );
         }
 
         if( inputStream == NULL ) {
             throw NullPointerException(
-                __FILE__, __LINE__,
-                "DataInputStream::readFully - Base input stream is null" );
+                __FILE__, __LINE__, "Base input stream is null" );
+        }
+
+        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 + length > size ) {
+        if( length < 0 || length > size - offset ) {
             throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "Offset + Length is greater than the size of the Buffer." );
+                __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
         }
 
-        std::size_t n = 0;
+        int n = 0;
         while( n < length ) {
             int count = inputStream->read( buffer, length, offset + n, length - n );
             if( count == -1 ) {
                 throw EOFException(
-                    __FILE__, __LINE__,
-                    "DataInputStream::readFully - Reached EOF" );
+                    __FILE__, __LINE__, "Reached EOF" );
             }
             n += count;
         }
     }
     DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
     DECAF_CATCH_RETHROW( EOFException )
     DECAF_CATCH_RETHROW( IOException )
     DECAF_CATCHALL_THROW( IOException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::size_t DataInputStream::skipBytes( std::size_t num )
+long long DataInputStream::skipBytes( long long num )
     throw( decaf::io::IOException ) {
 
     try {
@@ -443,8 +455,8 @@ std::size_t DataInputStream::skipBytes( 
                 "DataInputStream::readFully - Base input stream is null" );
         }
 
-        std::size_t total = 0;
-        std::size_t cur = 0;
+        long long total = 0;
+        long long cur = 0;
 
         while( ( total < num ) &&
                ( ( cur = inputStream->skip( num-total ) ) > 0 ) ) {
@@ -458,17 +470,23 @@ std::size_t DataInputStream::skipBytes( 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataInputStream::readAllData( unsigned char* buffer, std::size_t length )
+void DataInputStream::readAllData( unsigned char* buffer, int length )
     throw ( decaf::io::IOException, decaf::io::EOFException ) {
 
-    std::size_t n = 0;
-    do{
-        int count = inputStream->read( buffer, length, n, length - n );
-        if( count == -1 ) {
-            throw EOFException(
-                __FILE__, __LINE__,
-                "DataInputStream::readLong - Reached EOF" );
-        }
-        n += count;
-    } while( n < length );
+    try{
+
+        int n = 0;
+        do{
+            int count = inputStream->read( buffer, length, n, length - n );
+            if( count == -1 ) {
+                throw EOFException(
+                    __FILE__, __LINE__,
+                    "DataInputStream::readLong - Reached EOF" );
+            }
+            n += count;
+        } while( n < length );
+    }
+    DECAF_CATCH_RETHROW( EOFException )
+    DECAF_CATCH_RETHROW( IOException )
+    DECAF_CATCHALL_THROW( IOException )
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.h?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/DataInputStream.h Sat Mar 20 21:57:20 2010
@@ -291,9 +291,12 @@ namespace io{
          *
          * @throws IOException if an I/O Error occurs.
          * @throws EOFException if the end of input is reached.
+         * @throws IndexOutOfBoundsException if the size value is negative.
          */
-        virtual void readFully( unsigned char* buffer, std::size_t size )
-            throw( decaf::io::IOException, decaf::io::EOFException );
+        virtual void readFully( unsigned char* buffer, int size )
+            throw( decaf::io::IOException,
+                   decaf::io::EOFException,
+                   decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Reads length bytes from an input stream.
@@ -326,8 +329,7 @@ namespace io{
          * @throws NullPointerException if the buffer is NULL.
          * @throws IndexOutOfBoundsException if the offset + length > size.
          */
-        virtual void readFully( unsigned char* buffer, std::size_t size,
-                                std::size_t offset, std::size_t length )
+        virtual void readFully( unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::io::EOFException,
                     decaf::lang::exceptions::NullPointerException,
@@ -348,12 +350,12 @@ namespace io{
          *
          * @throws IOException if an I/O Error occurs.
          */
-        virtual std::size_t skipBytes( std::size_t num ) throw( io::IOException );
+        virtual long long skipBytes( long long num ) throw( io::IOException );
 
     private:
 
         // Used internally to reliably get data from the underlying stream
-        void readAllData( unsigned char* buffer, std::size_t length )
+        void readAllData( unsigned char* buffer, int length )
             throw ( decaf::io::IOException, decaf::io::EOFException );
 
     };

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=925692&r1=925691&r2=925692&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 Sat Mar 20 21:57:20 2010
@@ -38,7 +38,7 @@ DataOutputStream::~DataOutputStream() {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::write( const unsigned char c ) throw ( IOException ) {
+void DataOutputStream::doWriteByte( const unsigned char c ) throw ( IOException ) {
     try {
 
         if( outputStream == NULL ) {
@@ -55,32 +55,7 @@ void DataOutputStream::write( const unsi
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::write( const std::vector<unsigned char>& buffer )
-    throw ( IOException ) {
-
-    try {
-
-        if( buffer.size() == 0 ){
-            // nothing to write.
-            return;
-        }
-
-        if( outputStream == NULL ) {
-            throw IOException(
-                __FILE__, __LINE__,
-                "DataOutputStream::write - Base stream is Null");
-        }
-
-        outputStream->write( &buffer[0], buffer.size(), 0, buffer.size() );
-        written += buffer.size();
-    }
-    DECAF_CATCH_RETHROW( IOException )
-    DECAF_CATCHALL_THROW( IOException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void DataOutputStream::write( const unsigned char* buffer, std::size_t size,
-                              std::size_t offset, std::size_t length )
+void DataOutputStream::doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::NullPointerException,
             decaf::lang::exceptions::IndexOutOfBoundsException ) {
@@ -103,10 +78,19 @@ void DataOutputStream::write( const unsi
                 "DataOutputStream::write - passed buffer is Null" );
         }
 
-        if( ( offset + length ) > size ) {
-            throw decaf::lang::exceptions::IndexOutOfBoundsException(
-                __FILE__, __LINE__,
-                "DataOutputStream::write - given offset + length is greater than buffer 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( length < 0 || length > size - offset ) {
+            throw IndexOutOfBoundsException(
+                __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
         }
 
         outputStream->write( buffer, size, offset, length );

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=925692&r1=925691&r2=925692&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 Sat Mar 20 21:57:20 2010
@@ -35,7 +35,7 @@ namespace io{
     protected:
 
         // The number of bytes written to the data output stream so far.
-        std::size_t written;
+        long long written;
 
         // Buffer used for storing byte values to write to the stream
         unsigned char buffer[8];
@@ -55,178 +55,84 @@ namespace io{
         /**
          * Returns the current value of the counter written, the number of
          * bytes written to this data output stream so far. If the counter
-         * overflows, it will be wrapped to Integer.MAX_VALUE.
+         * overflows, it will be wrapped to decaf::lang::Long::MAX_VALUE.
+         *
          * @return the value of the written field.
          */
-        virtual std::size_t size() const {
+        virtual long long size() const {
             return written;
         }
 
         /**
-         * Writes a single byte to the output stream.  If no exception is
-         * thrown, the counter written is incremented by 1.
-         * @param c the byte.
-         * @throws IOException thrown if an error occurs.
-         */
-        virtual void write( unsigned char c ) throw ( IOException );
-
-        /**
-         * Writes an array of bytes to the output stream in order starting at buffer[offset]
-         * and proceeding until the number of bytes specified by the length argument are
-         * written or an error occurs.
-         *
-         * @param buffer
-         *      The array of bytes to write.
-         * @param size
-         *      The size of the buffer array passed.
-         * @param offset
-         *      The position to start writing in buffer.
-         * @param length
-         *      The number of bytes from the buffer to be written.
-         *
-         * @throws IOException if an I/O error occurs.
-         * @throws NullPointerException thrown if buffer is Null.
-         * @throws IndexOutOfBoundsException if the offset + length > size.
-         */
-        virtual void write( const unsigned char* buffer, std::size_t size,
-                            std::size_t offset, std::size_t length )
-            throw ( decaf::io::IOException,
-                    decaf::lang::exceptions::NullPointerException,
-                    decaf::lang::exceptions::IndexOutOfBoundsException );
-
-        /**
-         * Writes an array of bytes to the output stream.
-         * @param buffer The bytes to write.
-         * @throws IOException thrown if an error occurs.
-         */
-        virtual void write( const std::vector<unsigned char>& buffer )
-            throw ( IOException );
-
-        /**
-         * Writes a boolean to the underlying output stream as a 1-byte value. The
-         * value true is written out as the value (byte)1; the value false
-         * is written out as the value (byte)0. If no exception is thrown,
-         * the counter written is incremented by 1.
-         * @param value the boolean to write.
-         * @throws IOException
-         *
+         * {@inheritDoc}
          */
         virtual void writeBoolean( bool value ) throw ( IOException );
 
         /**
-         * Writes out a byte to the underlying output stream as a 1-byte
-         * value. If no exception is thrown, the counter written is
-         * incremented by 1.
-         * @param value the unsigned char value to write.
-         * @throws IOException
-         */
-        virtual void writeByte( unsigned char value ) throw ( IOException );
+         * {@inheritDoc}
+         */
+       virtual void writeByte( unsigned char value ) throw ( IOException );
 
         /**
-         * Writes a short to the underlying output stream as two bytes, high
-         * byte first. If no exception is thrown, the counter written is
-         * incremented by 2.
-         * @param value the value to write.
-         * @throws IOException
+         * {@inheritDoc}
          */
         virtual void writeShort( short value ) throw ( IOException );
 
         /**
-         * Writes a unsigned short to the bytes message stream as a 2 byte value
-         * @param value - unsigned short to write to the stream
-         * @throws IOException
+         * {@inheritDoc}
          */
         virtual void writeUnsignedShort( unsigned short value ) throw ( IOException );
 
         /**
-         * Writes out a char to the underlying output stream as a one byte
-         * value If no exception is thrown, the counter written is
-         * incremented by 1.
-         * @param value the value to write.
-         * @throws IOException
+         * {@inheritDoc}
          */
         virtual void writeChar( char value ) throw ( IOException );
 
         /**
-         * Writes an int to the underlying output stream as four bytes, high
-         * byte first. If no exception is thrown, the counter written is
-         * incremented by 4.
-         * @param value the value to write.
-         * @throws IOException
+         * {@inheritDoc}
          */
         virtual void writeInt( int value ) throw ( IOException );
 
         /**
-         * Writes an 64 bit long to the underlying output stream as eight
-         * bytes, high byte first. If no exception is thrown, the counter
-         * written is incremented by 8.
-         * @param value the value to write.
-         * @throws IOException
+         * {@inheritDoc}
          */
         virtual void writeLong( long long value ) throw ( IOException );
 
         /**
-         * Converts the float argument to an int using the floatToIntBits
-         * method in class Float, and then writes that int value to the
-         * underlying output stream as a 4-byte quantity, high byte first.
-         * If no exception is thrown, the counter written is incremented
-         * by 4.
-         * @param value the value to write.
-         * @throws IOException
+         * {@inheritDoc}
          */
         virtual void writeFloat( float value ) throw ( IOException );
 
         /**
-         * Converts the double argument to a long using the doubleToLongBits
-         * method in class Double, and then writes that long value to the
-         * underlying output stream as an 8-byte quantity, high byte first.
-         * If no exception is thrown, the counter written is incremented
-         * by 8.
-         * @param value the value to write.
-         * @throws IOException
+         * {@inheritDoc}
          */
         virtual void writeDouble( double value ) throw ( IOException );
 
         /**
-         * Writes out the string to the underlying output stream as a
-         * sequence of bytes. Each character in the string is written out,
-         * in sequence, by discarding its high eight bits. If no exception
-         * is thrown, the counter written is incremented by the length of
-         * value.  The value written does not include a trailing null as that
-         * is not part of the sequence of bytes, if the null is needed, then use
-         * the writeChars method.
-         * @param value the value to write.
-         * @throws IOException
+         * {@inheritDoc}
          */
         virtual void writeBytes( const std::string& value ) throw ( IOException );
 
         /**
-         * Writes a string to the underlying output stream as a sequence of
-         * characters. Each character is written to the data output stream
-         * as if by the writeChar method. If no exception is thrown, the
-         * counter written is incremented by the length of value.  The trailing
-         * NULL character is written by this method.
-         * @param value the value to write.
-         * @throws IOException
+         * {@inheritDoc}
          */
         virtual void writeChars( const std::string& value ) throw ( IOException );
 
         /**
-         * Writes out the string to the underlying output stream as a modeified UTF-8
-         * encoded sequence of bytes.  The first two bytes written are indicate its
-         * encoded length followed by the rest of the string's characters encoded as
-         * modified UTF-8.  The length represent the encoded length of the data not the
-         * actual length of the string.
-         *
-         * @param value
-         *        the value to write.
-         *
-         * @throws IOException - on a write error
-         * @throws UTFDataFormatException - if encoded size if greater than 65535
+         * {@inheritDoc}
          */
         virtual void writeUTF( const std::string& value )
             throw ( IOException, UTFDataFormatException );
 
+    protected:
+
+        virtual void doWriteByte( unsigned char value ) throw ( decaf::io::IOException );
+
+        virtual void doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length )
+            throw ( decaf::io::IOException,
+                    decaf::lang::exceptions::NullPointerException,
+                    decaf::lang::exceptions::IndexOutOfBoundsException );
+
     private:
 
         // Determine the encoded length of a string when written as modified UTF-8

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.cpp Sat Mar 20 21:57:20 2010
@@ -48,7 +48,7 @@ FilterInputStream::~FilterInputStream() 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::size_t FilterInputStream::available() const throw ( IOException ) {
+int FilterInputStream::available() const throw ( IOException ) {
 
     try {
 
@@ -118,7 +118,7 @@ bool FilterInputStream::markSupported() 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::size_t FilterInputStream::skip( std::size_t num )
+long long FilterInputStream::skip( long long num )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::UnsupportedOperationException ) {
 
@@ -155,8 +155,9 @@ int FilterInputStream::doReadByte() thro
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int FilterInputStream::doReadArray( unsigned char* buffer, std::size_t size )
+int FilterInputStream::doReadArray( unsigned char* buffer, int size )
     throw ( decaf::io::IOException,
+            decaf::lang::exceptions::IndexOutOfBoundsException,
             decaf::lang::exceptions::NullPointerException ) {
 
     try {
@@ -175,8 +176,7 @@ int FilterInputStream::doReadArray( unsi
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int FilterInputStream::doReadArrayBounded( unsigned char* buffer, std::size_t size,
-                                           std::size_t offset, std::size_t length )
+int FilterInputStream::doReadArrayBounded( unsigned char* buffer, int size, int offset, int length )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::IndexOutOfBoundsException,
             decaf::lang::exceptions::NullPointerException ) {

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=925692&r1=925691&r2=925692&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 Sat Mar 20 21:57:20 2010
@@ -62,85 +62,34 @@ namespace io{
         virtual ~FilterInputStream();
 
         /**
-         * Returns the number of bytes that can be read from this input stream
-         * without blocking.  This method simply performs in.available() and
-         * returns the result.
-         * @return the number of bytes available without blocking.
-         */
-        virtual std::size_t available() const throw ( decaf::io::IOException );
+         * {@inheritDoc}
+         */
+        virtual int available() const throw ( decaf::io::IOException );
 
         /**
-         * Close the Stream, the FilterOutputStream simply calls the close
-         * method of the underlying stream
-         *
-         * @throws IOException if an I/O error occurs
+         * {@inheritDoc}
          */
         virtual void close() throw ( decaf::io::IOException );
 
         /**
-         * Skips over and discards n bytes of data from this input stream. The
-         * skip method may, for a variety of reasons, end up skipping over some
-         * smaller number of bytes, possibly 0. This may result from any of a
-         * number of conditions; reaching end of file before n bytes have been
-         * skipped is only one possibility. The actual number of bytes skipped
-         * is returned. If n is negative, no bytes are skipped.
-         * <p>
-         * The skip method of InputStream creates a byte array and then
-         * repeatedly reads into it until n bytes have been read or the end
-         * of the stream has been reached. Subclasses are encouraged to
-         * provide a more efficient implementation of this method.
-         * @param num - the number of bytes to skip
-         * @returns total butes skipped
-         * @throws IOException if an I/O error occurs
+         * {@inheritDoc}
          */
-        virtual std::size_t skip( std::size_t num )
+        virtual long long skip( long long num )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::UnsupportedOperationException );
 
         /**
-         * Marks the current position in the stream A subsequent call to the
-         * reset method repositions this stream at the last marked position so
-         * that subsequent reads re-read the same bytes.
-         *
-         * If a stream instance reports that marks are supported then the stream
-         * will ensure that the same bytes can be read again after the reset method
-         * is called so long the readLimit is not reached.
-         *
-         * @param readLimit
-         *      The max bytes read before marked position is invalid.
+         * {@inheritDoc}
          */
         virtual void mark( int readLimit );
 
         /**
-         * Repositions this stream to the position at the time the mark method was
-         * last called on this input stream.
-         *
-         * If the method markSupported returns true, then:
-         *   * If the method mark has not been called since the stream was created,
-         *     or the number of bytes read from the stream since mark was last called
-         * 	   is larger than the argument to mark at that last call, then an
-         *     IOException might be thrown.
-         *   * If such an IOException is not thrown, then the stream is reset to a
-         *     state such that all the bytes read since the most recent call to mark
-         *     (or since the start of the file, if mark has not been called) will be
-         *     resupplied to subsequent callers of the read method, followed by any
-         *     bytes that otherwise would have been the next input data as of the
-         *     time of the call to reset.
-         * If the method markSupported returns false, then:
-         *   * The call to reset may throw an IOException.
-         *   * If an IOException is not thrown, then the stream is reset to a fixed
-         *     state that depends on the particular type of the input stream and how
-         *     it was created. The bytes that will be supplied to subsequent callers
-         *     of the read method depend on the particular type of the input stream.
-         * @throws IOException
+         * {@inheritDoc}
          */
         virtual void reset() throw ( decaf::io::IOException );
 
         /**
-         * Determines if this input stream supports the mark and reset methods.
-         * Whether or not mark and reset are supported is an invariant property of
-         * a particular input stream instance.
-         * @returns true if this stream instance supports marks
+         * {@inheritDoc}
          */
         virtual bool markSupported() const;
 
@@ -148,12 +97,12 @@ namespace io{
 
         virtual int doReadByte() throw ( decaf::io::IOException );
 
-        virtual int doReadArray( unsigned char* buffer, std::size_t size )
+        virtual int doReadArray( unsigned char* buffer, int size )
             throw ( decaf::io::IOException,
+                    decaf::lang::exceptions::IndexOutOfBoundsException,
                     decaf::lang::exceptions::NullPointerException );
 
-        virtual int doReadArrayBounded( unsigned char* buffer, std::size_t size,
-                                        std::size_t offset, std::size_t length )
+        virtual int doReadArrayBounded( unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::IndexOutOfBoundsException,
                     decaf::lang::exceptions::NullPointerException );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.cpp Sat Mar 20 21:57:20 2010
@@ -63,8 +63,10 @@ void FilterOutputStream::doWriteByte( un
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void FilterOutputStream::doWriteArray( const unsigned char* buffer, std::size_t size )
-    throw ( decaf::io::IOException ) {
+void FilterOutputStream::doWriteArray( const unsigned char* buffer, int size )
+    throw ( decaf::io::IOException,
+            decaf::lang::exceptions::NullPointerException,
+            decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try {
 
@@ -77,12 +79,13 @@ void FilterOutputStream::doWriteArray( c
         this->doWriteArrayBounded( buffer, size, 0, size );
     }
     DECAF_CATCH_RETHROW( IOException )
+    DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
     DECAF_CATCHALL_THROW( IOException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void FilterOutputStream::doWriteArrayBounded( const unsigned char* buffer, std::size_t size,
-                                              std::size_t offset, std::size_t length )
+void FilterOutputStream::doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::NullPointerException,
             decaf::lang::exceptions::IndexOutOfBoundsException ) {
@@ -101,14 +104,23 @@ void FilterOutputStream::doWriteArrayBou
                 "FilterOutputStream::write - Buffer passed is Null.");
         }
 
-        if( ( offset + length ) > size ) {
-            throw decaf::lang::exceptions::IndexOutOfBoundsException(
-                __FILE__, __LINE__,
-                "FilterOutputStream::write - given offset + length is greater than buffer 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( length < 0 || length > size - offset ) {
+            throw IndexOutOfBoundsException(
+                __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
         }
 
         // Calls the doWriteByte method since subclasses may over override that method.
-        for( std::size_t ix = offset; ix < offset + length; ++ix ) {
+        for( int ix = offset; ix < offset + length; ++ix ) {
             this->doWriteByte( buffer[ix] );
         }
     }

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=925692&r1=925691&r2=925692&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 Sat Mar 20 21:57:20 2010
@@ -98,11 +98,12 @@ namespace io{
 
         virtual void doWriteByte( unsigned char value ) throw ( decaf::io::IOException );
 
-        virtual void doWriteArray( const unsigned char* buffer, std::size_t size )
-            throw( decaf::io::IOException );
+        virtual void doWriteArray( const unsigned char* buffer, int size )
+            throw ( decaf::io::IOException,
+                    decaf::lang::exceptions::NullPointerException,
+                    decaf::lang::exceptions::IndexOutOfBoundsException );
 
-        virtual void doWriteArrayBounded( const unsigned char* buffer, std::size_t size,
-                                          std::size_t offset, std::size_t length )
+        virtual void doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::NullPointerException,
                     decaf::lang::exceptions::IndexOutOfBoundsException );

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=925692&r1=925691&r2=925692&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 Sat Mar 20 21:57:20 2010
@@ -66,7 +66,7 @@ int InputStream::read() throw ( decaf::i
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int InputStream::read( unsigned char* buffer, std::size_t size )
+int InputStream::read( unsigned char* buffer, int size )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::NullPointerException ) {
 
@@ -79,8 +79,8 @@ int InputStream::read( unsigned char* bu
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int InputStream::read( unsigned char* buffer, std::size_t size,
-                       std::size_t offset, std::size_t length )
+int InputStream::read( unsigned char* buffer, int size,
+                       int offset, int length )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::IndexOutOfBoundsException,
             decaf::lang::exceptions::NullPointerException ) {
@@ -95,7 +95,7 @@ int InputStream::read( unsigned char* bu
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::size_t InputStream::skip( std::size_t num )
+long long InputStream::skip( long long num )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::UnsupportedOperationException ) {
 
@@ -105,17 +105,17 @@ std::size_t InputStream::skip( std::size
             return 0;
         }
 
-        std::size_t skipped = 0;
+        long long skipped = 0;
 
         // 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.
-        std::size_t toRead = num < 4096 ? num : 4096;
+        int toRead = num < 4096 ? num : 4096;
         std::vector<unsigned char> buffer( toRead );
 
         while( skipped < num ) {
 
-            int read = doReadArrayBounded( &buffer[0], buffer.size(), 0, toRead );
+            int read = doReadArrayBounded( &buffer[0], (int)buffer.size(), 0, toRead );
 
             // Is it EOF?
             if( read == -1 ) {
@@ -124,11 +124,11 @@ std::size_t InputStream::skip( std::size
 
             skipped += read;
 
-            if( (std::size_t)read < toRead ) {
+            if( read < toRead ) {
                 return skipped;
             }
             if( num - skipped < toRead ) {
-                toRead = num - skipped;
+                toRead = (int)( num - skipped );
             }
         }
         return skipped;
@@ -139,8 +139,9 @@ std::size_t InputStream::skip( std::size
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int InputStream::doReadArray( unsigned char* buffer, std::size_t size )
+int InputStream::doReadArray( unsigned char* buffer, int size )
     throw ( decaf::io::IOException,
+            decaf::lang::exceptions::IndexOutOfBoundsException,
             decaf::lang::exceptions::NullPointerException ) {
 
     try{
@@ -152,8 +153,8 @@ int InputStream::doReadArray( unsigned c
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int InputStream::doReadArrayBounded( unsigned char* buffer, std::size_t size,
-                                     std::size_t offset, std::size_t length )
+int InputStream::doReadArrayBounded( unsigned char* buffer, int size,
+                                     int offset, int length )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::IndexOutOfBoundsException,
             decaf::lang::exceptions::NullPointerException ) {
@@ -174,7 +175,7 @@ int InputStream::doReadArrayBounded( uns
                 __FILE__, __LINE__, "Offset + Length given exceeds Buffer size." );
         }
 
-        for( std::size_t i = 0; i < length; i++ ) {
+        for( int i = 0; i < length; i++ ) {
 
             int c;
             try {

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=925692&r1=925691&r2=925692&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 Sat Mar 20 21:57:20 2010
@@ -130,7 +130,7 @@ namespace io{
          *
          * @throws IOException if an I/O error occurs.
          */
-        virtual std::size_t available() const throw ( decaf::io::IOException ) {
+        virtual int available() const throw ( decaf::io::IOException ) {
             return 0;
         }
 
@@ -177,7 +177,7 @@ namespace io{
          * @throws IOException if an I/O error occurs.
          * @throws NullPointerException if buffer passed is NULL.
          */
-        virtual int read( unsigned char* buffer, std::size_t size )
+        virtual int read( unsigned char* buffer, int size )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::NullPointerException );
 
@@ -226,8 +226,7 @@ namespace io{
          * @throws NullPointerException if buffer passed is NULL.
          * @throws IndexOutOfBoundsException if length > size - offset.
          */
-        virtual int read( unsigned char* buffer, std::size_t size,
-                          std::size_t offset, std::size_t length )
+        virtual int read( unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::IndexOutOfBoundsException,
                     decaf::lang::exceptions::NullPointerException );
@@ -245,7 +244,7 @@ namespace io{
          * implementation of this method.
          *
          * @param num
-         *       The number of bytes to skip
+         *       The number of bytes to skip.
          *
          * @returns total bytes skipped
          *
@@ -253,7 +252,7 @@ namespace io{
          * @throws UnsupportedOperationException if the concrete stream class does
          *         not support skipping bytes.
          */
-        virtual std::size_t skip( std::size_t num )
+        virtual long long skip( long long num )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::UnsupportedOperationException );
 
@@ -270,12 +269,12 @@ namespace io{
 
         virtual int doReadByte() throw( decaf::io::IOException ) = 0;
 
-        virtual int doReadArray( unsigned char* buffer, std::size_t size )
+        virtual int doReadArray( unsigned char* buffer, int size )
             throw ( decaf::io::IOException,
+                    decaf::lang::exceptions::IndexOutOfBoundsException,
                     decaf::lang::exceptions::NullPointerException );
 
-        virtual int doReadArrayBounded( unsigned char* buffer, std::size_t size,
-                                        std::size_t offset, std::size_t length )
+        virtual int doReadArrayBounded( unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::IndexOutOfBoundsException,
                     decaf::lang::exceptions::NullPointerException );

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=925692&r1=925691&r2=925692&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 Sat Mar 20 21:57:20 2010
@@ -84,8 +84,7 @@ bool InputStreamReader::ready() const th
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int InputStreamReader::doReadArrayBounded( char* buffer, std::size_t size,
-                                           std::size_t offset, std::size_t length )
+int InputStreamReader::doReadArrayBounded( char* buffer, int size, int offset, int length )
         throw( decaf::io::IOException,
                decaf::lang::exceptions::NullPointerException,
                decaf::lang::exceptions::IndexOutOfBoundsException ) {

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=925692&r1=925691&r2=925692&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 Sat Mar 20 21:57:20 2010
@@ -73,8 +73,7 @@ namespace io {
 
     protected:
 
-        virtual int doReadArrayBounded( char* buffer, std::size_t size,
-                                        std::size_t offset, std::size_t length )
+        virtual int doReadArrayBounded( char* buffer, int size, int offset, int length )
             throw( decaf::io::IOException,
                    decaf::lang::exceptions::IndexOutOfBoundsException,
                    decaf::lang::exceptions::NullPointerException );

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=925692&r1=925691&r2=925692&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 Sat Mar 20 21:57:20 2010
@@ -57,19 +57,22 @@ void OutputStream::write( unsigned char 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void OutputStream::write( const unsigned char* buffer, std::size_t size )
-    throw ( decaf::io::IOException ) {
+void OutputStream::write( const unsigned char* buffer, int size )
+    throw ( decaf::io::IOException,
+            decaf::lang::exceptions::NullPointerException,
+            decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
         this->doWriteArray( buffer, size );
     }
     DECAF_CATCH_RETHROW( IOException )
+    DECAF_CATCH_RETHROW( NullPointerException )
+    DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
     DECAF_CATCHALL_THROW( IOException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void OutputStream::write( const unsigned char* buffer, std::size_t size,
-                          std::size_t offset, std::size_t length )
+void OutputStream::write( const unsigned char* buffer, int size, int offset, int length )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::NullPointerException,
             decaf::lang::exceptions::IndexOutOfBoundsException ) {
@@ -84,8 +87,10 @@ void OutputStream::write( const unsigned
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void OutputStream::doWriteArray( const unsigned char* buffer, std::size_t size )
-    throw ( decaf::io::IOException ) {
+void OutputStream::doWriteArray( const unsigned char* buffer, int size )
+    throw ( decaf::io::IOException,
+            decaf::lang::exceptions::NullPointerException,
+            decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
     try{
         this->doWriteArrayBounded( buffer, size, 0, size );
@@ -95,8 +100,7 @@ void OutputStream::doWriteArray( const u
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void OutputStream::doWriteArrayBounded( const unsigned char* buffer, std::size_t size,
-                                        std::size_t offset, std::size_t length )
+void OutputStream::doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::NullPointerException,
             decaf::lang::exceptions::IndexOutOfBoundsException ) {
@@ -108,12 +112,22 @@ void OutputStream::doWriteArrayBounded( 
                 __FILE__, __LINE__, "Buffer pointer passed was NULL." );
         }
 
-        if( offset > size || length > size - offset ) {
+        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( length < 0 || length > size - offset ) {
             throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "Offset + Length greater than buffer size." );
+                __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
         }
 
-        for( std::size_t i = offset; i < offset + length; i++ ) {
+        for( int i = offset; i < offset + length; i++ ) {
             this->doWriteByte( buffer[i] );
         }
     }

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=925692&r1=925691&r2=925692&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 Sat Mar 20 21:57:20 2010
@@ -91,9 +91,13 @@ namespace io{
          *      The size of the buffer passed.
          *
          * @throws IOException if an I/O error occurs.
+         * @throws NullPointerException thrown if buffer is Null.
+         * @throws IndexOutOfBoundsException if size value is negative.
          */
-        virtual void write( const unsigned char* buffer, std::size_t size )
-            throw ( decaf::io::IOException );
+        virtual void write( const unsigned char* buffer, int size )
+            throw ( decaf::io::IOException,
+                    decaf::lang::exceptions::NullPointerException,
+                    decaf::lang::exceptions::IndexOutOfBoundsException );
 
         /**
          * Writes an array of bytes to the output stream in order starting at buffer[offset]
@@ -116,10 +120,10 @@ namespace io{
          *
          * @throws IOException if an I/O error occurs.
          * @throws NullPointerException thrown if buffer is Null.
-         * @throws IndexOutOfBoundsException if the offset + length > size.
+         * @throws IndexOutOfBoundsException if the offset + length > size. or one of the
+         *         parameters is negative.
          */
-        virtual void write( const unsigned char* buffer, std::size_t size,
-                            std::size_t offset, std::size_t length )
+        virtual void write( const unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::NullPointerException,
                     decaf::lang::exceptions::IndexOutOfBoundsException );
@@ -138,11 +142,12 @@ namespace io{
         virtual void doWriteByte( unsigned char value )
             throw( decaf::io::IOException ) = 0;
 
-        virtual void doWriteArray( const unsigned char* buffer, std::size_t size )
-            throw ( decaf::io::IOException );
+        virtual void doWriteArray( const unsigned char* buffer, int size )
+            throw ( decaf::io::IOException,
+                    decaf::lang::exceptions::NullPointerException,
+                    decaf::lang::exceptions::IndexOutOfBoundsException );
 
-        virtual void doWriteArrayBounded( const unsigned char* buffer, std::size_t size,
-                                          std::size_t offset, std::size_t length )
+        virtual void doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::NullPointerException,
                     decaf::lang::exceptions::IndexOutOfBoundsException );

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=925692&r1=925691&r2=925692&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 Sat Mar 20 21:57:20 2010
@@ -80,8 +80,7 @@ void OutputStreamWriter::flush() throw( 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void OutputStreamWriter::doWriteArrayBounded( const char* buffer, std::size_t size,
-                                              std::size_t offset, std::size_t length )
+void OutputStreamWriter::doWriteArrayBounded( const char* buffer, int size, int offset, int length )
     throw( decaf::io::IOException,
            decaf::lang::exceptions::NullPointerException,
            decaf::lang::exceptions::IndexOutOfBoundsException ) {

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=925692&r1=925691&r2=925692&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 Sat Mar 20 21:57:20 2010
@@ -68,8 +68,7 @@ namespace io {
 
     protected:
 
-        virtual void doWriteArrayBounded( const char* buffer, std::size_t size,
-                                          std::size_t offset, std::size_t length )
+        virtual void doWriteArrayBounded( const char* buffer, int size, int offset, int length )
             throw( decaf::io::IOException,
                    decaf::lang::exceptions::NullPointerException,
                    decaf::lang::exceptions::IndexOutOfBoundsException );

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=925692&r1=925691&r2=925692&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 Sat Mar 20 21:57:20 2010
@@ -32,9 +32,15 @@ PushbackInputStream::PushbackInputStream
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-PushbackInputStream::PushbackInputStream( InputStream* stream, std::size_t bufSize, bool own )
+PushbackInputStream::PushbackInputStream( InputStream* stream, int bufSize, bool own )
+    throw( decaf::lang::exceptions::IllegalArgumentException )
  :  FilterInputStream( stream, own ), bufferSize( bufSize ), pos( bufSize ) {
 
+    if( bufSize < 0 ) {
+        throw IllegalArgumentException(
+            __FILE__, __LINE__, "Size of Push Back buffer cannot be negative." );
+    }
+
     this->buffer = new unsigned char[bufSize];
 }
 
@@ -50,7 +56,7 @@ PushbackInputStream::~PushbackInputStrea
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::size_t PushbackInputStream::available() const throw ( decaf::io::IOException ) {
+int PushbackInputStream::available() const throw ( decaf::io::IOException ) {
 
     try{
         return ( this->bufferSize - this->pos ) + inputStream->available();
@@ -60,13 +66,13 @@ std::size_t PushbackInputStream::availab
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::size_t PushbackInputStream::skip( std::size_t num )
+long long PushbackInputStream::skip( long long num )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::UnsupportedOperationException ) {
 
     try{
 
-        if( num == 0 ) {
+        if( num <= 0 ) {
             return 0;
         }
 
@@ -75,12 +81,12 @@ std::size_t PushbackInputStream::skip( s
                 __FILE__, __LINE__, "Stream is closed" );
         }
 
-        std::size_t unread = bufferSize - pos;
-        std::size_t numSkipped = 0;
+        long long unread = bufferSize - pos;
+        long long numSkipped = 0;
 
         if( unread != 0 ) {
             numSkipped += ( num < unread ) ? num : unread;
-            pos += numSkipped;
+            pos += (int)numSkipped;
         }
 
         if( numSkipped < num ) {
@@ -122,11 +128,18 @@ void PushbackInputStream::unread( unsign
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void PushbackInputStream::unread( const unsigned char* buffer, std::size_t size )
+void PushbackInputStream::unread( const unsigned char* buffer, int size )
     throw( decaf::io::IOException,
+           decaf::lang::exceptions::IndexOutOfBoundsException,
            decaf::lang::exceptions::NullPointerException ) {
 
     try{
+
+        if( size < 0 ) {
+            throw IndexOutOfBoundsException(
+                __FILE__, __LINE__, "Given size of the buffer was negatiev." );
+        }
+
         this->unread( buffer, size, 0, size );
     }
     DECAF_CATCH_RETHROW( IOException )
@@ -135,8 +148,7 @@ void PushbackInputStream::unread( const 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void PushbackInputStream::unread( const unsigned char* buffer, std::size_t size,
-                                  std::size_t offset, std::size_t length )
+void PushbackInputStream::unread( const unsigned char* buffer, int size, int offset, int length )
     throw( decaf::io::IOException,
            decaf::lang::exceptions::IndexOutOfBoundsException,
            decaf::lang::exceptions::NullPointerException ) {
@@ -148,9 +160,19 @@ void PushbackInputStream::unread( const 
                 __FILE__, __LINE__, "No Space left in the unread buffer." );
         }
 
-        if( offset > size || offset + length > 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 + length exceeds supplied buffer's size." );
+                __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( buffer == NULL ) {
@@ -188,8 +210,7 @@ int PushbackInputStream::doReadByte() th
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int PushbackInputStream::doReadArrayBounded( unsigned char* buffer, std::size_t size,
-                                             std::size_t offset, std::size_t length )
+int PushbackInputStream::doReadArrayBounded( unsigned char* buffer, int size, int offset, int length )
     throw ( decaf::io::IOException,
             decaf::lang::exceptions::IndexOutOfBoundsException,
             decaf::lang::exceptions::NullPointerException ) {
@@ -206,14 +227,24 @@ int PushbackInputStream::doReadArrayBoun
                 __FILE__, __LINE__, "Buffer pointer passed was NULL." );
         }
 
-        if( offset > size || offset + length > 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( length < 0 || length > size - offset ) {
             throw IndexOutOfBoundsException(
-                __FILE__, __LINE__, "Offset + length exceeds supplied buffer's size." );
+                __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
         }
 
-        std::size_t copiedBytes = 0;
-        std::size_t copyLength = 0;
-        std::size_t newOffset = offset;
+        int copiedBytes = 0;
+        int copyLength = 0;
+        int newOffset = offset;
 
         // Are there pushback bytes available?
         if( pos < bufferSize ) {
@@ -227,19 +258,19 @@ int PushbackInputStream::doReadArrayBoun
 
         // Have we copied enough?
         if( copyLength == length ) {
-            return (int)length;
+            return length;
         }
 
         int inCopied = inputStream->read( buffer, size, newOffset, length - copiedBytes );
         if( inCopied > 0 ) {
-            return (int)( inCopied + copiedBytes );
+            return inCopied + copiedBytes;
         }
 
         if( copiedBytes == 0 ) {
             return inCopied;
         }
 
-        return (int)copiedBytes;
+        return copiedBytes;
     }
     DECAF_CATCH_RETHROW( IOException )
     DECAF_CATCH_RETHROW( IndexOutOfBoundsException )

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=925692&r1=925691&r2=925692&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 Sat Mar 20 21:57:20 2010
@@ -43,14 +43,37 @@ namespace io {
     private:
 
         unsigned char* buffer;
-        std::size_t bufferSize;
-        std::size_t pos;
+        int bufferSize;
+        int pos;
 
     public:
 
+        /**
+         * Creates a PushbackInputStream  and saves its argument, the input stream in, for later
+         * use. Initially, there is no pushed-back byte.
+         *
+         * @param stream
+         *      The InputStream instance to wrap.
+         * @param
+         *      Boolean value indicating if this FilterInputStream owns the wrapped stream.
+         */
         PushbackInputStream( InputStream* stream, bool own = false );
 
-        PushbackInputStream( InputStream* stream, std::size_t bufSize, bool own = false );
+        /**
+         * Creates a PushbackInputStream  and saves its argument, the input stream in, for later
+         * use. Initially, there is no pushed-back byte.
+         *
+         * @param stream
+         *      The InputStream instance to wrap.
+         * @param bufSize
+         *      The number of byte to allocate for pushback into this stream.
+         * @param
+         *      Boolean value indicating if this FilterInputStream owns the wrapped stream.
+         *
+         * @throws IllegalArgumentException if the bufSize argument is < zero.
+         */
+        PushbackInputStream( InputStream* stream, int bufSize, bool own = false )
+            throw( decaf::lang::exceptions::IllegalArgumentException );
 
         virtual ~PushbackInputStream();
 
@@ -77,11 +100,13 @@ namespace io {
          *      The size of the array to be copied.
          *
          * @throws NullPointerException if the buffer passed is NULL.
+         * @throws IndexOutOfBoundsException if the size value given is negative.
          * @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, std::size_t size )
+        void unread( const unsigned char* buffer, int size )
             throw( decaf::io::IOException,
+                   decaf::lang::exceptions::IndexOutOfBoundsException,
                    decaf::lang::exceptions::NullPointerException );
 
         /**
@@ -102,18 +127,18 @@ 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, std::size_t size, std::size_t offset, std::size_t length )
+        void unread( const unsigned char* buffer, int size, int offset, int length )
             throw( decaf::io::IOException,
                    decaf::lang::exceptions::IndexOutOfBoundsException,
                    decaf::lang::exceptions::NullPointerException );
 
         /**
-         * {@inheritdoc}
+         * {@inheritDoc}
          *
          * Returns the sum of the number of pushed back bytes if any and the amount of bytes
          * available in the underlying stream via a call to available.
          */
-        virtual std::size_t available() const throw ( decaf::io::IOException );
+        virtual int available() const throw ( decaf::io::IOException );
 
         /**
          * {@inheritDoc}
@@ -122,7 +147,7 @@ namespace io {
          * complete the request by calling the underlying stream skip method with the remainder
          * of bytes that needs to be skipped.
          */
-        virtual std::size_t skip( std::size_t num )
+        virtual long long skip( long long num )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::UnsupportedOperationException );
 
@@ -153,8 +178,7 @@ namespace io {
 
         virtual int doReadByte() throw ( decaf::io::IOException );
 
-        virtual int doReadArrayBounded( unsigned char* buffer, std::size_t size,
-                                        std::size_t offset, std::size_t length )
+        virtual int doReadArrayBounded( unsigned char* buffer, int size, int offset, int length )
             throw ( decaf::io::IOException,
                     decaf::lang::exceptions::IndexOutOfBoundsException,
                     decaf::lang::exceptions::NullPointerException );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Reader.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Reader.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Reader.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Reader.cpp Sat Mar 20 21:57:20 2010
@@ -38,7 +38,7 @@ Reader::~Reader() {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void Reader::mark( std::size_t readAheadLimit DECAF_UNUSED )
+void Reader::mark( int readAheadLimit DECAF_UNUSED )
     throw( decaf::io::IOException ) {
 
     throw IOException(
@@ -60,19 +60,19 @@ void Reader::reset() throw( decaf::io::I
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-std::size_t Reader::skip( std::size_t count )
+long long Reader::skip( long long count )
     throw( decaf::io::IOException ) {
 
     try{
 
-        std::size_t skipped = 0;
+        long long skipped = 0;
         int toRead = count < 512 ? (int)count : 512;
 
         std::vector<char> charsSkipped( toRead );
 
         while( skipped < count ) {
 
-            int read = this->doReadArrayBounded( &charsSkipped[0], charsSkipped.size(), 0, toRead );
+            int read = this->doReadArrayBounded( &charsSkipped[0], (int)charsSkipped.size(), 0, toRead );
 
             if( read == -1 ) {
                 return skipped;
@@ -84,7 +84,7 @@ std::size_t Reader::skip( std::size_t co
                 return skipped;
             }
 
-            if( count - skipped < (std::size_t)toRead ) {
+            if( count - skipped < (long long)toRead ) {
                 toRead = (int)( count - skipped );
             }
         }
@@ -106,7 +106,7 @@ int Reader::read( std::vector<char>& buf
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int Reader::read( char* buffer, std::size_t length )
+int Reader::read( char* buffer, int length )
    throw( decaf::io::IOException,
           decaf::lang::exceptions::NullPointerException ) {
 
@@ -118,7 +118,7 @@ int Reader::read( char* buffer, std::siz
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int Reader::read( char* buffer, std::size_t size, std::size_t offset, std::size_t length )
+int Reader::read( char* buffer, int size, int offset, int length )
     throw( decaf::io::IOException,
            decaf::lang::exceptions::IndexOutOfBoundsException,
            decaf::lang::exceptions::NullPointerException ) {
@@ -173,7 +173,7 @@ int Reader::doReadVector( std::vector<ch
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-int Reader::doReadArray( char* buffer, std::size_t length )
+int Reader::doReadArray( char* buffer, int length )
     throw( decaf::io::IOException,
            decaf::lang::exceptions::NullPointerException ) {
 
@@ -230,7 +230,7 @@ int Reader::doReadCharBuffer( decaf::nio
         length = Math::min( length, this->doReadVector( buffer ) );
 
         if( length > 0 ) {
-            charBuffer->put( &buffer[0], 0, length );
+            charBuffer->put( &buffer[0], buffer.size() , 0, length );
         }
 
         return length;

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Reader.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Reader.h?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Reader.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Reader.h Sat Mar 20 21:57:20 2010
@@ -58,7 +58,7 @@ namespace io{
          *
          * @throw IOException if an I/O error occurs, or the stream does not support mark.
          */
-        virtual void mark( std::size_t readAheadLimit ) throw( decaf::io::IOException );
+        virtual void mark( int readAheadLimit ) throw( decaf::io::IOException );
 
         /**
          * Tells whether this stream supports the mark() operation. The default implementation
@@ -102,7 +102,7 @@ namespace io{
          *
          * @throw IOException if an I/O error occurs.
          */
-        virtual std::size_t skip( std::size_t count ) throw( decaf::io::IOException );
+        virtual long long skip( long long count ) throw( decaf::io::IOException );
 
         /**
          * Reads characters into an array. This method will block until some input is available,
@@ -132,7 +132,7 @@ namespace io{
          * @throws IOException thrown if an I/O error occurs.
          * @throws NullPointerException if buffer is NULL.
          */
-        virtual int read( char* buffer, std::size_t length )
+        virtual int read( char* buffer, int size )
            throw( decaf::io::IOException,
                   decaf::lang::exceptions::NullPointerException );
 
@@ -155,7 +155,7 @@ namespace io{
          * @throws NullPointerException if buffer is NULL.
          * @throws IndexOutOfBoundsException if the offset + length is greater than the array size.
          */
-        virtual int read( char* buffer, std::size_t size, std::size_t offset, std::size_t length )
+        virtual int read( char* buffer, int size, int offset, int length )
             throw( decaf::io::IOException,
                    decaf::lang::exceptions::IndexOutOfBoundsException,
                    decaf::lang::exceptions::NullPointerException );
@@ -183,13 +183,12 @@ namespace io{
 
         /**
          * Override this method to customize the functionality of the method
-         * read( char* buffer, std::size_t offset, std::size_t length ).
+         * read( unsigned char* buffer, int size, int offset, int length ).
          *
          * All subclasses must override this method to provide the basic Reader
          * functionality.
          */
-        virtual int doReadArrayBounded( char* buffer, std::size_t size,
-                                        std::size_t offset, std::size_t length )
+        virtual int doReadArrayBounded( char* buffer, int size, int offset, int length )
             throw( decaf::io::IOException,
                    decaf::lang::exceptions::NullPointerException,
                    decaf::lang::exceptions::IndexOutOfBoundsException ) = 0;
@@ -207,7 +206,7 @@ namespace io{
          * Override this method to customize the functionality of the method
          * read( char* buffer, std::size_t length ).
          */
-        virtual int doReadArray( char* buffer, std::size_t length )
+        virtual int doReadArray( char* buffer, int length )
             throw( decaf::io::IOException,
                    decaf::lang::exceptions::NullPointerException );
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Writer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Writer.cpp?rev=925692&r1=925691&r2=925692&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Writer.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/Writer.cpp Sat Mar 20 21:57:20 2010
@@ -48,7 +48,7 @@ void Writer::write( const std::vector<ch
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void Writer::write( const char* buffer, std::size_t size )
+void Writer::write( const char* buffer, int size )
     throw( decaf::io::IOException,
            decaf::lang::exceptions::NullPointerException ) {
 
@@ -61,7 +61,7 @@ void Writer::write( const char* buffer, 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void Writer::write( const char* buffer, std::size_t size, std::size_t offset, std::size_t length )
+void Writer::write( const char* buffer, int size, int offset, int length )
     throw( decaf::io::IOException,
            decaf::lang::exceptions::NullPointerException,
            decaf::lang::exceptions::IndexOutOfBoundsException ) {
@@ -86,12 +86,12 @@ void Writer::write( const std::string& s
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void Writer::write( const std::string& str, std::size_t offset, std::size_t length )
+void Writer::write( const std::string& str, int offset, int length )
     throw( IOException, IndexOutOfBoundsException ) {
 
     try {
 
-        if( ( offset + length ) > str.length() ) {
+        if( ( offset + length ) > (int)str.length() ) {
             throw IndexOutOfBoundsException(
                 __FILE__, __LINE__, "Given Offset + Length value greater than the String length." );
         }
@@ -125,7 +125,7 @@ Appendable& Writer::append( const decaf:
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-Appendable& Writer::append( const decaf::lang::CharSequence* csq, std::size_t start, std::size_t end )
+Appendable& Writer::append( const decaf::lang::CharSequence* csq, int start, int end )
     throw( decaf::io::IOException,
            decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
@@ -159,7 +159,7 @@ void Writer::doWriteVector( const std::v
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void Writer::doWriteArray( const char* buffer, std::size_t size )
+void Writer::doWriteArray( const char* buffer, int size )
     throw( decaf::io::IOException,
            decaf::lang::exceptions::NullPointerException ) {
 
@@ -182,7 +182,7 @@ void Writer::doWriteString( const std::s
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void Writer::doWriteStringBounded( const std::string& str, std::size_t offset, std::size_t length )
+void Writer::doWriteStringBounded( const std::string& str, int offset, int length )
     throw( decaf::io::IOException,
            decaf::lang::exceptions::IndexOutOfBoundsException ) {
 
@@ -225,7 +225,7 @@ decaf::lang::Appendable& Writer::doAppen
 
 ////////////////////////////////////////////////////////////////////////////////
 decaf::lang::Appendable& Writer::doAppendCharSequenceStartEnd( const decaf::lang::CharSequence* csq,
-                                                               std::size_t start, std::size_t end )
+                                                               int start, int end )
     throw( decaf::io::IOException,
            decaf::lang::exceptions::IndexOutOfBoundsException ) {
 



Mime
View raw message