Author: tabish
Date: Sat Feb 27 17:29:48 2010
New Revision: 916995
URL: http://svn.apache.org/viewvc?rev=916995&view=rev
Log:
Some minor fixes and cleanups
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterOutputStream.cpp
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=916995&r1=916994&r2=916995&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 Feb 27 17:29:48 2010
@@ -96,7 +96,7 @@
if( isClosed() ) {
throw IOException(
__FILE__, __LINE__,
- "FilterInputStream::skip - Stream is closed" );
+ "FilterInputStream::reset - Stream is closed" );
}
return inputStream->reset();
@@ -145,7 +145,7 @@
if( isClosed() ) {
throw IOException(
__FILE__, __LINE__,
- "FilterInputStream::read - Stream is closed" );
+ "FilterInputStream::doReadByte - Stream is closed" );
}
return inputStream->read();
@@ -155,6 +155,26 @@
}
////////////////////////////////////////////////////////////////////////////////
+int FilterInputStream::doReadArray( unsigned char* buffer, std::size_t size )
+ throw ( decaf::io::IOException,
+ decaf::lang::exceptions::NullPointerException ) {
+
+ try {
+
+ if( isClosed() ) {
+ throw IOException(
+ __FILE__, __LINE__,
+ "FilterInputStream::doReadArray - Stream is closed" );
+ }
+
+ return doReadArrayBounded( buffer, size, 0, size );
+ }
+ DECAF_CATCH_RETHROW( IOException )
+ DECAF_CATCH_RETHROW( NullPointerException )
+ DECAF_CATCHALL_THROW( IOException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
int FilterInputStream::doReadArrayBounded( unsigned char* buffer, std::size_t
size,
std::size_t offset, std::size_t
length )
throw ( decaf::io::IOException,
@@ -166,7 +186,7 @@
if( isClosed() ) {
throw IOException(
__FILE__, __LINE__,
- "FilterInputStream::read - Stream is closed" );
+ "FilterInputStream::doReadArrayBounded - Stream is closed" );
}
return inputStream->read( buffer, size, offset, length );
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=916995&r1=916994&r2=916995&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 Feb 27 17:29:48 2010
@@ -148,6 +148,10 @@
virtual int doReadByte() throw ( decaf::io::IOException );
+ virtual int doReadArray( unsigned char* buffer, std::size_t size )
+ throw ( decaf::io::IOException,
+ decaf::lang::exceptions::NullPointerException );
+
virtual int doReadArrayBounded( unsigned char* buffer, std::size_t
size,
std::size_t offset, std::size_t length
)
throw ( decaf::io::IOException,
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=916995&r1=916994&r2=916995&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 Feb 27 17:29:48 2010
@@ -74,9 +74,7 @@
"FilterOutputStream::write - Stream is closed" );
}
- for( std::size_t ix = 0; ix < size; ++ix ) {
- this->outputStream->write( buffer[ix] );
- }
+ this->doWriteArrayBounded( buffer, size, 0, size );
}
DECAF_CATCH_RETHROW( IOException )
DECAF_CATCHALL_THROW( IOException )
@@ -109,8 +107,9 @@
"FilterOutputStream::write - given offset + length is greater
than buffer size.");
}
+ // Calls the doWriteByte method since subclasses may over override
that method.
for( std::size_t ix = offset; ix < offset + length; ++ix ) {
- this->outputStream->write( buffer[ix] );
+ this->doWriteByte( buffer[ix] );
}
}
DECAF_CATCH_RETHROW( IOException )