You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2009/11/11 17:01:48 UTC
svn commit: r834931 [2/3] - in
/activemq/activemq-cpp/trunk/activemq-cpp/src: main/
main/activemq/commands/ main/activemq/core/ main/activemq/io/ main/cms/
main/decaf/internal/io/ main/decaf/io/ main/decaf/lang/ main/decaf/net/
test/ test/activemq/comm...
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQStreamMessage.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQStreamMessage.h?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQStreamMessage.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQStreamMessage.h Wed Nov 11 16:01:47 2009
@@ -24,7 +24,6 @@
#endif
#include <activemq/util/Config.h>
-#include <activemq/util/PrimitiveList.h>
#include <activemq/commands/ActiveMQMessage.h>
#include <activemq/commands/ActiveMQMessageTemplate.h>
#include <cms/StreamMessage.h>
@@ -33,6 +32,9 @@
#include <cms/MessageFormatException.h>
#include <cms/MessageEOFException.h>
#include <decaf/lang/exceptions/NullPointerException.h>
+#include <decaf/io/DataInputStream.h>
+#include <decaf/io/DataOutputStream.h>
+#include <decaf/io/ByteArrayOutputStream.h>
#include <string>
#include <memory>
@@ -43,12 +45,11 @@
public ActiveMQMessageTemplate< cms::StreamMessage > {
private:
- // Map Structure to hold unmarshaled Map Data
- mutable std::auto_ptr<util::PrimitiveList> list;
+ mutable std::auto_ptr<decaf::io::ByteArrayOutputStream> bytesOut;
+ mutable std::auto_ptr<decaf::io::DataInputStream> dataIn;
+ mutable std::auto_ptr<decaf::io::DataOutputStream> dataOut;
- // When Message is readable this is the index of the next
- // element to be read.
- mutable std::size_t currentPos;
+ mutable int remainingBytes;
public:
@@ -91,20 +92,9 @@
virtual bool equals( const DataStructure* value ) const;
/**
- * Determine if this object is aware of marshaling and should have
- * its before and after marshaling methods called. Defaults to false.
- * @returns true if aware of marshaling
+ * Store the Data that was written to the stream before a send
*/
- virtual bool isMarshalAware() const {
- return true;
- }
-
- /**
- * Perform any processing needed before an marshal
- * @param wireFormat - the OpenWireFormat object in use.
- */
- virtual void beforeMarshal( wireformat::WireFormat* wireFormat )
- throw ( decaf::io::IOException );
+ virtual void onSend();
public: // CMS Message
@@ -121,11 +111,7 @@
* Clears out the body of the message. This does not clear the
* headers or properties.
*/
- virtual void clearBody() throw( cms::CMSException ) {
-
- // Invoke base class's version.
- ActiveMQMessageTemplate<cms::StreamMessage>::clearBody();
- }
+ virtual void clearBody() throw( cms::CMSException );
public: // CMS Stream Message
@@ -137,37 +123,63 @@
virtual void reset() throw ( cms::CMSException );
/**
- * Reads a Boolean from the Bytes message stream
+ * Reads a Boolean from the Stream message stream
* @returns boolean value from stream
- * @throws CMSException
- */
- virtual bool readBoolean() const throw ( cms::CMSException );
+ *
+ * @throw CMSException - if the CMS provider fails to read the message
+ * due to some internal error.
+ * @throw MessageEOFException - if unexpected end of message stream has been reached.
+ * @throw MessageFormatException - if this type conversion is invalid.
+ * @throw MessageNotReadableException - if the message is in write-only mode.
+ */
+ virtual bool readBoolean() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException );
/**
- * Writes a boolean to the bytes message stream as a 1-byte value.
+ * Writes a boolean to the Stream message stream as a 1-byte value.
* The value true is written as the value (byte)1; the value false
* is written as the value (byte)0.
- * @param value - boolean to write to the stream
- * @throws CMSException
+ *
+ * @param value
+ * boolean to write to the stream
+ * @throws CMSException - if the CMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeBoolean( bool value ) throw ( cms::CMSException );
+ virtual void writeBoolean( bool value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException );
/**
- * Reads a Byte from the Bytes message stream
+ * Reads a Byte from the Stream message stream
+ *
* @returns unsigned char value from stream
- * @throws CMSException
- */
- virtual unsigned char readByte() const throw ( cms::CMSException );
+ * @throw CMSException - if the CMS provider fails to read the message
+ * due to some internal error.
+ * @throw MessageEOFException - if unexpected end of message stream has been reached.
+ * @throw MessageFormatException - if this type conversion is invalid.
+ * @throw MessageNotReadableException - if the message is in write-only mode.
+ */
+ virtual unsigned char readByte() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException );
/**
- * Writes a byte to the bytes message stream as a 1-byte value
- * @param value - byte to write to the stream
- * @throws CMSException
+ * Writes a byte to the Stream message stream as a 1-byte value
+ *
+ * @param value
+ * byte to write to the stream
+ * @throws CMSException - if the CMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeByte( unsigned char value ) throw ( cms::CMSException );
+ virtual void writeByte( unsigned char value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException );
/**
- * Reads a byte array from the bytes message stream.
+ * Reads a byte array from the Stream message stream.
*
* If the length of vector value is less than the number of bytes
* remaining to be read from the stream, the vector should be filled. A
@@ -179,26 +191,39 @@
* length of the vector, indicating that there are no more bytes left to
* be read from the stream. The next read of the stream returns -1.
*
- * @param value - buffer to place data in
+ * @param value
+ * buffer to place data in
* @returns the total number of bytes read into the buffer, or -1 if
* there is no more data because the end of the stream has
* been reached
- * @throws CMSException if an error occurs.
+ * @throw CMSException - if the CMS provider fails to read the message
+ * due to some internal error.
+ * @throw MessageEOFException - if unexpected end of message stream has been reached.
+ * @throw MessageFormatException - if this type conversion is invalid.
+ * @throw MessageNotReadableException - if the message is in write-only mode.
*/
virtual std::size_t readBytes( std::vector<unsigned char>& value ) const
- throw ( cms::CMSException );
+ throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException );
/**
- * Writes a byte array to the bytes message stream using the vector
+ * Writes a byte array to the Stream message stream using the vector
* size as the number of bytes to write.
- * @param value - bytes to write to the stream
- * @throws CMSException
- */
- virtual void writeBytes(
- const std::vector<unsigned char>& value ) throw ( cms::CMSException );
+ *
+ * @param value
+ * bytes to write to the stream
+ * @throws CMSException - if the CMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException - if the message is in read-only mode.
+ */
+ virtual void writeBytes( const std::vector<unsigned char>& value )
+ throw ( cms::MessageNotWriteableException,
+ cms::CMSException );
/**
- * Reads a portion of the bytes message stream.
+ * Reads a portion of the Stream message stream.
*
* If the length of array value is less than the number of bytes
* remaining to be read from the stream, the array should be filled. A
@@ -211,167 +236,268 @@
* be read from the stream. The next read of the stream returns -1.
*
* If length is negative, or length is greater than the length of the
- * array value, then an IndexOutOfBoundsException is thrown. No bytes
+ * array value, then an CMSException is thrown. No bytes
* will be read from the stream for this exception case.
*
- * @param buffer - the buffer into which the data is read
- * @param length - the number of bytes to read; must be less than or
- * equal to value.length
+ * @param buffer
+ * the buffer into which the data is read
+ * @param length
+ * the number of bytes to read; must be less than or equal to
+ * value.length
* @returns the total number of bytes read into the buffer, or -1 if
* there is no more data because the end of the stream has
* been reached
- * @throws CMSException
- */
- virtual std::size_t readBytes( unsigned char*& buffer, std::size_t length ) const
- throw ( cms::CMSException );
+ * @throw CMSException - if the CMS provider fails to read the message
+ * due to some internal error.
+ * @throw MessageEOFException - if unexpected end of message stream has been reached.
+ * @throw MessageFormatException - if this type conversion is invalid.
+ * @throw MessageNotReadableException - if the message is in write-only mode.
+ */
+ virtual std::size_t readBytes( unsigned char* buffer, std::size_t length ) const
+ throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException );
/**
- * Writes a portion of a byte array to the bytes message stream.
+ * Writes a portion of a byte array to the Stream message stream.
* size as the number of bytes to write.
- * @param value - bytes to write to the stream
- * @param offset - the initial offset within the byte array
- * @param length - the number of bytes to use
- * @throws CMSException
- */
- virtual void writeBytes( const unsigned char* value,
- std::size_t offset,
- std::size_t length ) throw ( cms::CMSException );
+ *
+ * @param value
+ * bytes to write to the stream
+ * @param offset
+ * the initial offset within the byte array
+ * @param length
+ * the number of bytes to use
+ * @throws CMSException - if the CMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException - if the message is in read-only mode.
+ */
+ virtual void writeBytes( const unsigned char* value, std::size_t offset, std::size_t length )
+ throw ( cms::MessageNotWriteableException,
+ cms::CMSException );
/**
- * Reads a Char from the Bytes message stream
+ * Reads a Char from the Stream message stream
+ *
* @returns char value from stream
- * @throws CMSException
- */
- virtual char readChar() const throw ( cms::CMSException );
+ * @throw CMSException - if the CMS provider fails to read the message
+ * due to some internal error.
+ * @throw MessageEOFException - if unexpected end of message stream has been reached.
+ * @throw MessageFormatException - if this type conversion is invalid.
+ * @throw MessageNotReadableException - if the message is in write-only mode.
+ */
+ virtual char readChar() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException );
/**
- * Writes a char to the bytes message stream as a 1-byte value
- * @param value - char to write to the stream
- * @throws CMSException
+ * Writes a char to the Stream message stream as a 1-byte value
+ *
+ * @param value
+ * char to write to the stream
+ * @throws CMSException - if the CMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeChar( char value ) throw ( cms::CMSException );
+ virtual void writeChar( char value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException );
/**
- * Reads a 32 bit float from the Bytes message stream
+ * Reads a 32 bit float from the Stream message stream
+ *
* @returns double value from stream
- * @throws CMSException
+ * @throw CMSException - if the CMS provider fails to read the message
+ * due to some internal error.
+ * @throw MessageEOFException - if unexpected end of message stream has been reached.
+ * @throw MessageFormatException - if this type conversion is invalid.
+ * @throw MessageNotReadableException - if the message is in write-only mode.
+ */
+ virtual float readFloat() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException );
+
+ /**
+ * Writes a float to the Stream message stream as a 4 byte value
+ * @param value
+ * float to write to the stream
+ * @throws CMSException - if the CMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual float readFloat() const throw ( cms::CMSException );
+ virtual void writeFloat( float value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException );
/**
- * Writes a float to the bytes message stream as a 4 byte value
- * @param value - float to write to the stream
- * @throws CMSException
- */
- virtual void writeFloat( float value ) throw ( cms::CMSException );
-
- /**
- * Reads a 64 bit double from the Bytes message stream
+ * Reads a 64 bit double from the Stream message stream
+ *
* @returns double value from stream
- * @throws CMSException
+ * @throw CMSException - if the CMS provider fails to read the message
+ * due to some internal error.
+ * @throw MessageEOFException - if unexpected end of message stream has been reached.
+ * @throw MessageFormatException - if this type conversion is invalid.
+ * @throw MessageNotReadableException - if the message is in write-only mode.
+ */
+ virtual double readDouble() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException );
+
+ /**
+ * Writes a double to the Stream message stream as a 8 byte value
+ * @param value
+ * double to write to the stream
+ * @throws CMSException - if the CMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual double readDouble() const throw ( cms::CMSException );
+ virtual void writeDouble( double value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException );
/**
- * Writes a double to the bytes message stream as a 8 byte value
- * @param value - double to write to the stream
- * @throws CMSException
- */
- virtual void writeDouble( double value ) throw ( cms::CMSException );
-
- /**
- * Reads a 16 bit signed short from the Bytes message stream
+ * Reads a 16 bit signed short from the Stream message stream
+ *
* @returns short value from stream
- * @throws CMSException
- */
- virtual short readShort() const throw ( cms::CMSException );
+ * @throw CMSException - if the CMS provider fails to read the message
+ * due to some internal error.
+ * @throw MessageEOFException - if unexpected end of message stream has been reached.
+ * @throw MessageFormatException - if this type conversion is invalid.
+ * @throw MessageNotReadableException - if the message is in write-only mode.
+ */
+ virtual short readShort() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException );
/**
- * Writes a signed short to the bytes message stream as a 2 byte value
- * @param value - signed short to write to the stream
- * @throws CMSException
+ * Writes a signed short to the Stream message stream as a 2 byte value
+ *
+ * @param value
+ * signed short to write to the stream
+ * @throws CMSException - if the CMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeShort( short value ) throw ( cms::CMSException );
+ virtual void writeShort( short value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException );
/**
- * Reads a 16 bit unsigned short from the Bytes message stream
+ * Reads a 16 bit unsigned short from the Stream message stream
+ *
* @returns unsigned short value from stream
- * @throws CMSException
- */
- virtual unsigned short readUnsignedShort() const throw ( cms::CMSException );
+ * @throw CMSException - if the CMS provider fails to read the message
+ * due to some internal error.
+ * @throw MessageEOFException - if unexpected end of message stream has been reached.
+ * @throw MessageFormatException - if this type conversion is invalid.
+ * @throw MessageNotReadableException - if the message is in write-only mode.
+ */
+ virtual unsigned short readUnsignedShort() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException );
/**
- * Writes a unsigned short to the bytes message stream as a 2 byte value
- * @param value - unsigned short to write to the stream
- * @throws CMSException
+ * Writes a unsigned short to the Stream message stream as a 2 byte value
+ *
+ * @param value
+ * unsigned short to write to the stream
+ * @throws CMSException - if the CMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeUnsignedShort( unsigned short value ) throw ( cms::CMSException );
+ virtual void writeUnsignedShort( unsigned short value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException );
/**
- * Reads a 32 bit signed intger from the Bytes message stream
+ * Reads a 32 bit signed integer from the Stream message stream
+ *
* @returns int value from stream
- * @throws CMSException
- */
- virtual int readInt() const throw ( cms::CMSException );
+ * @throw CMSException - if the CMS provider fails to read the message
+ * due to some internal error.
+ * @throw MessageEOFException - if unexpected end of message stream has been reached.
+ * @throw MessageFormatException - if this type conversion is invalid.
+ * @throw MessageNotReadableException - if the message is in write-only mode.
+ */
+ virtual int readInt() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException );
/**
- * Writes a signed int to the bytes message stream as a 4 byte value
- * @param value - signed int to write to the stream
- * @throws CMSException
+ * Writes a signed int to the Stream message stream as a 4 byte value
+ *
+ * @param value
+ * signed int to write to the stream
+ * @throws CMSException - if the CMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeInt( int value ) throw ( cms::CMSException );
+ virtual void writeInt( int value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException );
/**
- * Reads a 64 bit long from the Bytes message stream
+ * Reads a 64 bit long from the Stream message stream
+ *
* @returns long long value from stream
- * @throws CMSException
- */
- virtual long long readLong() const throw ( cms::CMSException );
+ * @throw CMSException - if the CMS provider fails to read the message
+ * due to some internal error.
+ * @throw MessageEOFException - if unexpected end of message stream has been reached.
+ * @throw MessageFormatException - if this type conversion is invalid.
+ * @throw MessageNotReadableException - if the message is in write-only mode.
+ */
+ virtual long long readLong() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException );
/**
- * Writes a long long to the bytes message stream as a 8 byte value
- * @param value - signed long long to write to the stream
- * @throws CMSException
+ * Writes a long long to the Stream message stream as a 8 byte value
+ *
+ * @param value
+ * signed long long to write to the stream
+ * @throws CMSException - if the CMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeLong( long long value ) throw ( cms::CMSException );
+ virtual void writeLong( long long value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException );
/**
- * Reads an ASCII String from the Bytes message stream
+ * Reads an ASCII String from the Stream message stream
+ *
* @returns String from stream
- * @throws CMSException
- */
- virtual std::string readString() const throw ( cms::CMSException );
+ * @throw CMSException - if the CMS provider fails to read the message
+ * due to some internal error.
+ * @throw MessageEOFException - if unexpected end of message stream has been reached.
+ * @throw MessageFormatException - if this type conversion is invalid.
+ * @throw MessageNotReadableException - if the message is in write-only mode.
+ */
+ virtual std::string readString() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException );
/**
- * Writes an ASCII String to the Bytes message stream
- * @param value - String to write to the stream
- * @throws CMSException
+ * Writes an ASCII String to the Stream message stream
+ *
+ * @param value
+ * String to write to the stream
+ * @throws CMSException - if the CMS provider fails to write the message due
+ * to some internal error.
+ * @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeString( const std::string& value ) throw ( cms::CMSException );
+ virtual void writeString( const std::string& value )throw ( cms::MessageNotWriteableException,
+ cms::CMSException );
- protected:
+ private:
- /**
- * Throws an exception if in write-only mode.
- * @throws CMSException.
- */
- void checkWriteOnlyBody() const throw( cms::CMSException );
+ void storeContent();
- /**
- * Fetches a reference to this objects PrimitiveList, if one needs
- * to be created or unmarshaled, this will perform the correct steps.
- * @returns reference to a PrimtiveList.
- */
- util::PrimitiveList& getList()
- throw ( decaf::lang::exceptions::NullPointerException );
- const util::PrimitiveList& getList() const
- throw ( decaf::lang::exceptions::NullPointerException );
+ void initializeReading() const;
- /**
- * Performs the unmarshal on the List if needed, otherwise just returns.
- */
- void checkListIsUnmarshalled() const
- throw ( decaf::lang::exceptions::NullPointerException );
+ void initializeWriting();
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQTextMessage.cpp Wed Nov 11 16:01:47 2009
@@ -100,7 +100,7 @@
////////////////////////////////////////////////////////////////////////////////
void ActiveMQTextMessage::setText( const std::string& msg ) throw( cms::CMSException ) {
try{
- checkReadOnlyBody();
+ failIfReadOnlyBody();
std::vector<unsigned char>& content = getContent();
content.clear();
decaf::io::ByteArrayOutputStream bos( content );
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Message.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Message.h?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Message.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/Message.h Wed Nov 11 16:01:47 2009
@@ -216,6 +216,11 @@
virtual bool isExpired() const;
/**
+ * Allows derived Message classes to perform tasks before a message is sent.
+ */
+ virtual void onSend() {}
+
+ /**
* Gets a reference to the Message's Properties object, allows the derived
* classes to get and set their own specific properties.
*
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp Wed Nov 11 16:01:47 2009
@@ -693,6 +693,7 @@
// around beyond the point that send returns.
Pointer<commands::Message> msgCopy( amqMessage->cloneDataStructure() );
+ msgCopy->onSend();
msgCopy->setProducerId( producer->getProducerInfo().getProducerId() );
if( this->connection->getSendTimeout() <= 0 &&
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.cpp?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.cpp Wed Nov 11 16:01:47 2009
@@ -36,7 +36,7 @@
LoggingInputStream::~LoggingInputStream() {}
////////////////////////////////////////////////////////////////////////////////
-unsigned char LoggingInputStream::read() throw ( IOException ) {
+int LoggingInputStream::read() throw ( IOException ) {
try {
unsigned char c = FilterInputStream::read();
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.h?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/io/LoggingInputStream.h Wed Nov 11 16:01:47 2009
@@ -50,7 +50,7 @@
* @return The next byte.
* @throws IOException thrown if an error occurs.
*/
- virtual unsigned char read() throw ( decaf::io::IOException );
+ virtual int read() throw ( decaf::io::IOException );
/**
* Reads an array of bytes from the buffer. Blocks until
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/StreamMessage.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/StreamMessage.h?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/StreamMessage.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/StreamMessage.h Wed Nov 11 16:01:47 2009
@@ -73,7 +73,10 @@
* @throw MessageFormatException - if this type conversion is invalid.
* @throw MessageNotReadableException - if the message is in write-only mode.
*/
- virtual bool readBoolean() const throw ( cms::CMSException ) = 0;
+ virtual bool readBoolean() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException ) = 0;
/**
* Writes a boolean to the Stream message stream as a 1-byte value.
@@ -86,7 +89,8 @@
* to some internal error.
* @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeBoolean( bool value ) throw ( cms::CMSException ) = 0;
+ virtual void writeBoolean( bool value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException ) = 0;
/**
* Reads a Byte from the Stream message stream
@@ -98,7 +102,10 @@
* @throw MessageFormatException - if this type conversion is invalid.
* @throw MessageNotReadableException - if the message is in write-only mode.
*/
- virtual unsigned char readByte() const throw ( cms::CMSException ) = 0;
+ virtual unsigned char readByte() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException ) = 0;
/**
* Writes a byte to the Stream message stream as a 1-byte value
@@ -109,7 +116,8 @@
* to some internal error.
* @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeByte( unsigned char value ) throw ( cms::CMSException ) = 0;
+ virtual void writeByte( unsigned char value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException ) = 0;
/**
* Reads a byte array from the Stream message stream.
@@ -136,7 +144,10 @@
* @throw MessageNotReadableException - if the message is in write-only mode.
*/
virtual std::size_t readBytes( std::vector<unsigned char>& value ) const
- throw ( cms::CMSException ) = 0;
+ throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException ) = 0;
/**
* Writes a byte array to the Stream message stream using the vector
@@ -149,7 +160,8 @@
* @throws MessageNotWriteableException - if the message is in read-only mode.
*/
virtual void writeBytes( const std::vector<unsigned char>& value )
- throw ( cms::CMSException ) = 0;
+ throw ( cms::MessageNotWriteableException,
+ cms::CMSException ) = 0;
/**
* Reads a portion of the Stream message stream.
@@ -182,8 +194,11 @@
* @throw MessageFormatException - if this type conversion is invalid.
* @throw MessageNotReadableException - if the message is in write-only mode.
*/
- virtual std::size_t readBytes( unsigned char*& buffer, std::size_t length ) const
- throw ( cms::CMSException ) = 0;
+ virtual std::size_t readBytes( unsigned char* buffer, std::size_t length ) const
+ throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException ) = 0;
/**
* Writes a portion of a byte array to the Stream message stream.
@@ -199,9 +214,9 @@
* to some internal error.
* @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeBytes( const unsigned char* value,
- std::size_t offset,
- std::size_t length ) throw ( cms::CMSException ) = 0;
+ virtual void writeBytes( const unsigned char* value, std::size_t offset, std::size_t length )
+ throw ( cms::MessageNotWriteableException,
+ cms::CMSException ) = 0;
/**
* Reads a Char from the Stream message stream
@@ -213,7 +228,10 @@
* @throw MessageFormatException - if this type conversion is invalid.
* @throw MessageNotReadableException - if the message is in write-only mode.
*/
- virtual char readChar() const throw ( cms::CMSException ) = 0;
+ virtual char readChar() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException ) = 0;
/**
* Writes a char to the Stream message stream as a 1-byte value
@@ -224,7 +242,8 @@
* to some internal error.
* @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeChar( char value ) throw ( cms::CMSException ) = 0;
+ virtual void writeChar( char value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException ) = 0;
/**
* Reads a 32 bit float from the Stream message stream
@@ -236,7 +255,10 @@
* @throw MessageFormatException - if this type conversion is invalid.
* @throw MessageNotReadableException - if the message is in write-only mode.
*/
- virtual float readFloat() const throw ( cms::CMSException ) = 0;
+ virtual float readFloat() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException ) = 0;
/**
* Writes a float to the Stream message stream as a 4 byte value
@@ -246,7 +268,8 @@
* to some internal error.
* @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeFloat( float value ) throw ( cms::CMSException ) = 0;
+ virtual void writeFloat( float value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException ) = 0;
/**
* Reads a 64 bit double from the Stream message stream
@@ -258,7 +281,10 @@
* @throw MessageFormatException - if this type conversion is invalid.
* @throw MessageNotReadableException - if the message is in write-only mode.
*/
- virtual double readDouble() const throw ( cms::CMSException ) = 0;
+ virtual double readDouble() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException ) = 0;
/**
* Writes a double to the Stream message stream as a 8 byte value
@@ -268,7 +294,8 @@
* to some internal error.
* @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeDouble( double value ) throw ( cms::CMSException ) = 0;
+ virtual void writeDouble( double value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException ) = 0;
/**
* Reads a 16 bit signed short from the Stream message stream
@@ -280,7 +307,10 @@
* @throw MessageFormatException - if this type conversion is invalid.
* @throw MessageNotReadableException - if the message is in write-only mode.
*/
- virtual short readShort() const throw ( cms::CMSException ) = 0;
+ virtual short readShort() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException ) = 0;
/**
* Writes a signed short to the Stream message stream as a 2 byte value
@@ -291,7 +321,8 @@
* to some internal error.
* @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeShort( short value ) throw ( cms::CMSException ) = 0;
+ virtual void writeShort( short value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException ) = 0;
/**
* Reads a 16 bit unsigned short from the Stream message stream
@@ -303,7 +334,10 @@
* @throw MessageFormatException - if this type conversion is invalid.
* @throw MessageNotReadableException - if the message is in write-only mode.
*/
- virtual unsigned short readUnsignedShort() const throw ( cms::CMSException ) = 0;
+ virtual unsigned short readUnsignedShort() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException ) = 0;
/**
* Writes a unsigned short to the Stream message stream as a 2 byte value
@@ -314,8 +348,8 @@
* to some internal error.
* @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeUnsignedShort( unsigned short value )
- throw ( cms::CMSException ) = 0;
+ virtual void writeUnsignedShort( unsigned short value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException ) = 0;
/**
* Reads a 32 bit signed integer from the Stream message stream
@@ -327,7 +361,10 @@
* @throw MessageFormatException - if this type conversion is invalid.
* @throw MessageNotReadableException - if the message is in write-only mode.
*/
- virtual int readInt() const throw ( cms::CMSException ) = 0;
+ virtual int readInt() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException ) = 0;
/**
* Writes a signed int to the Stream message stream as a 4 byte value
@@ -338,7 +375,8 @@
* to some internal error.
* @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeInt( int value ) throw ( cms::CMSException ) = 0;
+ virtual void writeInt( int value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException ) = 0;
/**
* Reads a 64 bit long from the Stream message stream
@@ -350,7 +388,10 @@
* @throw MessageFormatException - if this type conversion is invalid.
* @throw MessageNotReadableException - if the message is in write-only mode.
*/
- virtual long long readLong() const throw ( cms::CMSException ) = 0;
+ virtual long long readLong() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException ) = 0;
/**
* Writes a long long to the Stream message stream as a 8 byte value
@@ -361,7 +402,8 @@
* to some internal error.
* @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeLong( long long value ) throw ( cms::CMSException ) = 0;
+ virtual void writeLong( long long value ) throw ( cms::MessageNotWriteableException,
+ cms::CMSException ) = 0;
/**
* Reads an ASCII String from the Stream message stream
@@ -373,7 +415,10 @@
* @throw MessageFormatException - if this type conversion is invalid.
* @throw MessageNotReadableException - if the message is in write-only mode.
*/
- virtual std::string readString() const throw ( cms::CMSException ) = 0;
+ virtual std::string readString() const throw ( cms::MessageEOFException,
+ cms::MessageFormatException,
+ cms::MessageNotReadableException,
+ cms::CMSException ) = 0;
/**
* Writes an ASCII String to the Stream message stream
@@ -384,8 +429,8 @@
* to some internal error.
* @throws MessageNotWriteableException - if the message is in read-only mode.
*/
- virtual void writeString( const std::string& value )
- throw ( cms::CMSException ) = 0;
+ virtual void writeString( const std::string& value )throw ( cms::MessageNotWriteableException,
+ cms::CMSException ) = 0;
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.cpp?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.cpp Wed Nov 11 16:01:47 2009
@@ -44,7 +44,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-unsigned char StandardInputStream::read() throw ( decaf::io::IOException ) {
+int StandardInputStream::read() throw ( decaf::io::IOException ) {
if( !std::cin.good() ) {
throw decaf::io::IOException(
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.h?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/io/StandardInputStream.h Wed Nov 11 16:01:47 2009
@@ -50,7 +50,7 @@
* @return The next byte.
* @throws IOException thrown if an error occurs.
*/
- virtual unsigned char read() throw ( decaf::io::IOException );
+ virtual int read() throw ( decaf::io::IOException );
/**
* Reads an array of bytes from the buffer.
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.cpp?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.cpp Wed Nov 11 16:01:47 2009
@@ -81,7 +81,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-unsigned char BlockingByteArrayInputStream::read() throw ( IOException ){
+int BlockingByteArrayInputStream::read() throw ( IOException ){
try{
synchronized( this ){
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.h?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BlockingByteArrayInputStream.h Wed Nov 11 16:01:47 2009
@@ -101,7 +101,7 @@
* @return the next byte.
* @throws IOException if an error occurs.
*/
- virtual unsigned char read() throw ( IOException );
+ virtual int read() throw ( IOException );
/**
* Reads an array of bytes from the buffer. If the desired amount
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedInputStream.cpp?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedInputStream.cpp Wed Nov 11 16:01:47 2009
@@ -95,7 +95,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-unsigned char BufferedInputStream::read() throw ( IOException ){
+int BufferedInputStream::read() throw ( IOException ){
try{
@@ -114,10 +114,8 @@
if( isEmpty() ){
// If we hit EOF without getting any Data, then throw IOException
- if( bufferData() == -1 ){
- throw IOException(
- __FILE__, __LINE__,
- "BufferedInputStream::read - EOF has been Reached");
+ if( bufferData() == -1 ) {
+ return -1;
}
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedInputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedInputStream.h?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedInputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/BufferedInputStream.h Wed Nov 11 16:01:47 2009
@@ -115,7 +115,7 @@
* @return The next byte.
* @throws IOException thrown if an error occurs.
*/
- virtual unsigned char read() throw ( IOException );
+ virtual int read() throw ( IOException );
/**
* Reads an array of bytes from the buffer. Blocks
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayInputStream.cpp?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/ByteArrayInputStream.cpp Wed Nov 11 16:01:47 2009
@@ -87,7 +87,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-unsigned char ByteArrayInputStream::read() throw ( IOException ){
+int ByteArrayInputStream::read() throw ( IOException ){
if( activeBuffer == NULL ){
throw IOException(
@@ -96,9 +96,7 @@
}
if( pos == activeBuffer->end() ){
- throw IOException(
- __FILE__, __LINE__,
- "ByteArrayInputStream::read - Buffer is empty" );
+ return -1;
}
return *(pos++);
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=834931&r1=834930&r2=834931&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 Wed Nov 11 16:01:47 2009
@@ -124,7 +124,7 @@
* @return The next byte.
* @throws IOException thrown if an error occurs.
*/
- virtual unsigned char read() throw ( IOException );
+ virtual int read() throw ( IOException );
/**
* Reads an array of bytes from the buffer.
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=834931&r1=834930&r2=834931&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 Wed Nov 11 16:01:47 2009
@@ -72,7 +72,7 @@
* @return pointer to the data
*/
virtual const unsigned char* toByteArray() const {
- if( activeBuffer->size() == 0 ){
+ if( activeBuffer == NULL || activeBuffer->size() == 0 ){
return NULL;
}
@@ -80,6 +80,18 @@
}
/**
+ * Get a snapshot of the data
+ * @return reference to the underlying data as a const std::vector<unsigned char>&
+ */
+ virtual const std::vector<unsigned char> toByteArrayRef() const {
+ if( activeBuffer == NULL ){
+ return defaultBuffer;
+ }
+
+ return *activeBuffer;
+ }
+
+ /**
* Get the Size of the Internal Buffer
* @return size of the internal buffer
*/
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=834931&r1=834930&r2=834931&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 Wed Nov 11 16:01:47 2009
@@ -63,6 +63,10 @@
virtual ~DataInputStream();
+ virtual int read() throw ( IOException ) {
+ return FilterInputStream::read();
+ }
+
/**
* Reads some number of bytes from the contained input stream and
* stores them into the buffer array b. The number of bytes actually
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=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/FilterInputStream.h Wed Nov 11 16:01:47 2009
@@ -108,7 +108,7 @@
* @return The next byte.
* @throws IOException thrown if an error occurs.
*/
- virtual unsigned char read() throw ( IOException ) {
+ virtual int read() throw ( IOException ) {
try {
if( isClosed() ) {
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=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/io/InputStream.h Wed Nov 11 16:01:47 2009
@@ -91,12 +91,15 @@
virtual std::size_t available() const throw ( IOException ) = 0;
/**
- * Reads a single byte from the buffer. Blocks until
- * data is available.
- * @return The next byte.
+ * Reads a single byte from the buffer. The value byte is returned as an int in the
+ * range 0 to 255. If no byte is available because the end of the stream has been reached,
+ * the value -1 is returned. This method blocks until input data is available, the end of
+ * the stream is detected, or an exception is thrown.
+ *
+ * @return The next byte or -1 if the end of stream is reached.
* @throws IOException thrown if an error occurs.
*/
- virtual unsigned char read() throw ( IOException ) = 0;
+ virtual int read() throw ( IOException ) = 0;
/**
* Reads an array of bytes from the buffer. Blocks until
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Byte.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Byte.cpp?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Byte.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Byte.cpp Wed Nov 11 16:01:47 2009
@@ -35,7 +35,7 @@
////////////////////////////////////////////////////////////////////////////////
std::string Byte::toString() const {
- return string( 1, this->value );
+ return Integer::toString( value );
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.cpp?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.cpp Wed Nov 11 16:01:47 2009
@@ -135,7 +135,7 @@
}
////////////////////////////////////////////////////////////////////////////////
-unsigned char SocketInputStream::read() throw ( IOException ){
+int SocketInputStream::read() throw ( IOException ){
// Check for a closed call from socket class, if closed then this read fails.
if( closed ){
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.h?rev=834931&r1=834930&r2=834931&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketInputStream.h Wed Nov 11 16:01:47 2009
@@ -66,7 +66,7 @@
* @return The next byte.
* @throws IOException thrown if an error occurs.
*/
- virtual unsigned char read() throw ( io::IOException );
+ virtual int read() throw ( io::IOException );
/**
* Reads an array of bytes from the buffer. If the desired amount