activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r591725 - /activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/StandardErrorOutputStream.h
Date Sun, 04 Nov 2007 02:09:21 GMT
Author: tabish
Date: Sat Nov  3 19:09:20 2007
New Revision: 591725

URL: http://svn.apache.org/viewvc?rev=591725&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103
http://issues.apache.org/activemq/browse/AMQCPP-136

Modified:
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/StandardErrorOutputStream.h

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/StandardErrorOutputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/StandardErrorOutputStream.h?rev=591725&r1=591724&r2=591725&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/StandardErrorOutputStream.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/io/StandardErrorOutputStream.h Sat Nov
 3 19:09:20 2007
@@ -25,8 +25,7 @@
 namespace decaf{
 namespace io{
 
-    class DECAF_API StandardErrorOutputStream : public OutputStream
-    {
+    class DECAF_API StandardErrorOutputStream : public OutputStream {
     private:
 
         /**
@@ -44,6 +43,55 @@
         virtual ~StandardErrorOutputStream(void) {}
 
         /**
+         * Writes a single byte to the output stream.
+         * @param c the byte.
+         * @throws IOException thrown if an error occurs.
+         */
+        virtual void write( unsigned char c )
+            throw ( IOException ) {
+           std::cerr << c;
+        }
+
+        /**
+         * Writes an array of bytes to the output stream.
+         * @param buffer The array of bytes to write.
+         * @param len The number of bytes from the buffer to be written.
+         * @throws IOException thrown if an error occurs.
+         * @throws NullPointerException if buffer is null.
+         */
+        virtual void write( const unsigned char* buffer, int len )
+            throw ( IOException, lang::exceptions::NullPointerException ) {
+
+            if( buffer == NULL ) {
+                throw lang::exceptions::NullPointerException(
+                    __FILE__, __LINE__,
+                    "StandardErrorOutputStream::write - Passed buffer is null." );
+            }
+
+            for( int i = 0; i < len; ++i ) {
+                std::cerr << buffer[i];
+            }
+        }
+
+        /**
+         * Invokes flush on the target output stream.
+         * throws IOException if an error occurs
+         */
+        virtual void flush() throw ( IOException ){
+            std::cerr.flush();
+        }
+
+        /**
+         * Invokes close on the target output stream.
+         * throws CMSException if an error occurs
+         */
+        void close() throw( lang::Exception ){
+            std::cerr.flush();
+        }
+
+    public:
+
+        /**
          * Waits on a signal from this object, which is generated
          * by a call to Notify.  Must have this object locked before
          * calling.
@@ -101,48 +149,6 @@
          */
         virtual void notifyAll() throw( lang::Exception ){
             mutex.notifyAll();
-        }
-
-        /**
-         * Writes a single byte to the output stream.
-         * @param c the byte.
-         * @throws IOException thrown if an error occurs.
-         */
-        virtual void write( unsigned char c )
-            throw ( IOException )
-        {
-           std::cerr << c;
-        }
-
-        /**
-         * Writes an array of bytes to the output stream.
-         * @param buffer The array of bytes to write.
-         * @param len The number of bytes from the buffer to be written.
-         * @throws IOException thrown if an error occurs.
-         */
-        virtual void write( const unsigned char* buffer, int len )
-            throw ( IOException )
-        {
-            for(int i = 0; i < len; ++i)
-            {
-                std::cerr << buffer[i];
-            }
-        }
-
-        /**
-         * Invokes flush on the target output stream.
-         * throws IOException if an error occurs
-         */
-        virtual void flush() throw ( IOException ){
-            std::cerr.flush();
-        }
-
-        /**
-         * Invokes close on the target output stream.
-         * throws CMSException if an error occurs
-         */
-        void close() throw( lang::Exception ){
-            std::cerr.flush();
         }
 
     };



Mime
View raw message