activemq-cpp-3.4.0

decaf::io::OutputStream Class Reference

Base interface for any class that wants to represent an output stream of bytes. More...

#include <src/main/decaf/io/OutputStream.h>

Inheritance diagram for decaf::io::OutputStream:

Public Member Functions

 OutputStream ()
virtual ~OutputStream ()
virtual void close ()
 Closes this object and deallocates the appropriate resources.The object is generally no longer usable after calling close.
Exceptions:
IOExceptionif an error occurs while closing.

virtual void flush ()
 Flushes this stream by writing any buffered output to the underlying stream.
Exceptions:
IOExceptionif an I/O error occurs.

virtual void write (unsigned char c)
 Writes a single byte to the output stream.
virtual void write (const unsigned char *buffer, int size)
 Writes an array of bytes to the output stream.
virtual void write (const unsigned char *buffer, int size, int offset, int length)
 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.
virtual std::string toString () const
 Output a String representation of this object.
virtual void lock ()
 Locks the object.
virtual bool tryLock ()
 Attempts to Lock the object, if the lock is already held by another thread than this method returns false.
virtual void unlock ()
 Unlocks the object.
virtual void wait ()
 Waits on a signal from this object, which is generated by a call to Notify.
virtual void wait (long long millisecs)
 Waits on a signal from this object, which is generated by a call to Notify.
virtual void wait (long long millisecs, int nanos)
 Waits on a signal from this object, which is generated by a call to Notify.
virtual void notify ()
 Signals a waiter on this object that it can now wake up and continue.
virtual void notifyAll ()
 Signals the waiters on this object that it can now wake up and continue.

Protected Member Functions

virtual void doWriteByte (unsigned char value)=0
virtual void doWriteArray (const unsigned char *buffer, int size)
virtual void doWriteArrayBounded (const unsigned char *buffer, int size, int offset, int length)

Detailed Description

Base interface for any class that wants to represent an output stream of bytes.

Since:
1.0

Constructor & Destructor Documentation

decaf::io::OutputStream::OutputStream ( )
virtual decaf::io::OutputStream::~OutputStream ( ) [virtual]

Member Function Documentation

virtual void decaf::io::OutputStream::close ( ) [virtual]

Closes this object and deallocates the appropriate resources.The object is generally no longer usable after calling close.

Exceptions:
IOExceptionif an error occurs while closing.

The default implementation of this method does nothing.

Implements decaf::io::Closeable.

Reimplemented in decaf::internal::io::StandardErrorOutputStream, decaf::internal::io::StandardOutputStream, decaf::internal::net::ssl::openssl::OpenSSLSocketOutputStream, decaf::internal::net::tcp::TcpSocketOutputStream, decaf::io::FilterOutputStream, and decaf::util::zip::DeflaterOutputStream.

virtual void decaf::io::OutputStream::doWriteArray ( const unsigned char *  buffer,
int  size 
) [protected, virtual]
virtual void decaf::io::OutputStream::flush ( ) [virtual]

Flushes this stream by writing any buffered output to the underlying stream.

Exceptions:
IOExceptionif an I/O error occurs.

The default implementation of this method does nothing.

Implements decaf::io::Flushable.

Reimplemented in decaf::internal::io::StandardErrorOutputStream, decaf::internal::io::StandardOutputStream, decaf::io::BufferedOutputStream, and decaf::io::FilterOutputStream.

virtual void decaf::io::OutputStream::lock ( ) [inline, virtual]

Locks the object.

Exceptions:
RuntimeExceptionif an error occurs while locking the object.

Implements decaf::util::concurrent::Synchronizable.

virtual void decaf::io::OutputStream::notify ( ) [inline, virtual]

Signals a waiter on this object that it can now wake up and continue.

Must have this object locked before calling.

Exceptions:
IllegalMonitorStateException- if the current thread is not the owner of the the Synchronizable Object.
RuntimeExceptionif an error occurs while notifying one of the waiting threads.

Implements decaf::util::concurrent::Synchronizable.

virtual void decaf::io::OutputStream::notifyAll ( ) [inline, virtual]

Signals the waiters on this object that it can now wake up and continue.

Must have this object locked before calling.

Exceptions:
IllegalMonitorStateException- if the current thread is not the owner of the the Synchronizable Object.
RuntimeExceptionif an error occurs while notifying the waiting threads.

Implements decaf::util::concurrent::Synchronizable.

virtual std::string decaf::io::OutputStream::toString ( ) const [virtual]

Output a String representation of this object.

The default version of this method just prints the Class Name.

Returns:
a string representation of the object.

Reimplemented in decaf::io::ByteArrayOutputStream, and decaf::io::FilterOutputStream.

virtual bool decaf::io::OutputStream::tryLock ( ) [inline, virtual]

Attempts to Lock the object, if the lock is already held by another thread than this method returns false.

Returns:
true if the lock was acquired, false if it is already held by another thread.
Exceptions:
RuntimeExceptionif an error occurs while locking the object.

Implements decaf::util::concurrent::Synchronizable.

virtual void decaf::io::OutputStream::unlock ( ) [inline, virtual]

Unlocks the object.

Exceptions:
RuntimeExceptionif an error occurs while unlocking the object.

Implements decaf::util::concurrent::Synchronizable.

virtual void decaf::io::OutputStream::wait ( ) [inline, virtual]

Waits on a signal from this object, which is generated by a call to Notify.

Must have this object locked before calling.

Exceptions:
RuntimeExceptionif an error occurs while waiting on the object.
InterruptedExceptionif the wait is interrupted before it completes.
IllegalMonitorStateException- if the current thread is not the owner of the the Synchronizable Object.

Implements decaf::util::concurrent::Synchronizable.

virtual void decaf::io::OutputStream::wait ( long long  millisecs) [inline, virtual]

Waits on a signal from this object, which is generated by a call to Notify.

Must have this object locked before calling. This wait will timeout after the specified time interval.

Parameters:
millisecsthe time in milliseconds to wait, or WAIT_INIFINITE
Exceptions:
RuntimeExceptionif an error occurs while waiting on the object.
InterruptedExceptionif the wait is interrupted before it completes.
IllegalMonitorStateException- if the current thread is not the owner of the the Synchronizable Object.

Implements decaf::util::concurrent::Synchronizable.

virtual void decaf::io::OutputStream::wait ( long long  millisecs,
int  nanos 
) [inline, virtual]

Waits on a signal from this object, which is generated by a call to Notify.

Must have this object locked before calling. This wait will timeout after the specified time interval. This method is similar to the one argument wait function except that it add a finer grained control over the amount of time that it waits by adding in the additional nanosecond argument.

NOTE: The ability to wait accurately at a nanosecond scale depends on the platform and OS that the Decaf API is running on, some systems do not provide an accurate enough clock to provide this level of granularity.

Parameters:
millisecsthe time in milliseconds to wait, or WAIT_INIFINITE
nanosadditional time in nanoseconds with a range of 0-999999
Exceptions:
IllegalArgumentExceptionif an error occurs or the nanos argument is not in the range of [0-999999]
RuntimeExceptionif an error occurs while waiting on the object.
InterruptedExceptionif the wait is interrupted before it completes.
IllegalMonitorStateException- if the current thread is not the owner of the the Synchronizable Object.

Implements decaf::util::concurrent::Synchronizable.

virtual void decaf::io::OutputStream::write ( unsigned char  c) [virtual]

Writes a single byte to the output stream.

The default implementation of this method calls the pure virtual method doWriteByte which must be implemented by any subclass of the OutputStream.

Parameters:
cThe byte to write to the sink.
Exceptions:
IOExceptionif an I/O error occurs.
virtual void decaf::io::OutputStream::write ( const unsigned char *  buffer,
int  size 
) [virtual]

Writes an array of bytes to the output stream.

The entire contents of the given vector are written to the output stream.

The default implementation of this method simply calls the doWriteArray which writes the contents of the array using the doWriteByte method repeatedly. It is recommended that a subclass override doWriteArray to provide more performant means of writing the array.

Parameters:
bufferThe vector of bytes to write.
sizeThe size of the buffer passed.
Exceptions:
IOExceptionif an I/O error occurs.
NullPointerExceptionthrown if buffer is Null.
IndexOutOfBoundsExceptionif size value is negative.
virtual void decaf::io::OutputStream::write ( const unsigned char *  buffer,
int  size,
int  offset,
int  length 
) [virtual]

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.

The default implementation of this method simply calls the doWriteArrayBounded method which writes the contents of the array using the doWriteByte method repeatedly. It is recommended that a subclass override doWriteArrayBounded to provide more performant means of writing the array.

Parameters:
bufferThe array of bytes to write.
sizeThe size of the buffer array passed.
offsetThe position to start writing in buffer.
lengthThe number of bytes from the buffer to be written.
Exceptions:
IOExceptionif an I/O error occurs.
NullPointerExceptionthrown if buffer is Null.
IndexOutOfBoundsExceptionif the offset + length > size. or one of the parameters is negative.

The documentation for this class was generated from the following file: