activemq-cpp-3.4.0
|
Base interface for any class that wants to represent an output stream of bytes. More...
#include <src/main/decaf/io/OutputStream.h>
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.
| |||
virtual void | flush () | ||
Flushes this stream by writing any buffered output to the underlying stream.
| |||
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) |
Base interface for any class that wants to represent an output stream of bytes.
decaf::io::OutputStream::OutputStream | ( | ) |
virtual decaf::io::OutputStream::~OutputStream | ( | ) | [virtual] |
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.
IOException | if 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] |
Reimplemented in decaf::io::BufferedOutputStream, and decaf::io::FilterOutputStream.
virtual void decaf::io::OutputStream::doWriteArrayBounded | ( | const unsigned char * | buffer, |
int | size, | ||
int | offset, | ||
int | length | ||
) | [protected, virtual] |
Reimplemented in activemq::io::LoggingOutputStream, decaf::internal::io::StandardErrorOutputStream, decaf::internal::io::StandardOutputStream, decaf::internal::net::ssl::openssl::OpenSSLSocketOutputStream, decaf::internal::net::tcp::TcpSocketOutputStream, decaf::io::BufferedOutputStream, decaf::io::ByteArrayOutputStream, decaf::io::DataOutputStream, decaf::io::FilterOutputStream, decaf::util::zip::CheckedOutputStream, and decaf::util::zip::DeflaterOutputStream.
virtual void decaf::io::OutputStream::doWriteByte | ( | unsigned char | value | ) | [protected, pure virtual] |
Implemented in activemq::io::LoggingOutputStream, decaf::internal::io::StandardErrorOutputStream, decaf::internal::io::StandardOutputStream, decaf::internal::net::ssl::openssl::OpenSSLSocketOutputStream, decaf::internal::net::tcp::TcpSocketOutputStream, decaf::io::BufferedOutputStream, decaf::io::ByteArrayOutputStream, decaf::io::DataOutputStream, decaf::io::FilterOutputStream, decaf::util::zip::CheckedOutputStream, and decaf::util::zip::DeflaterOutputStream.
virtual void decaf::io::OutputStream::flush | ( | ) | [virtual] |
Flushes this stream by writing any buffered output to the underlying stream.
IOException | if 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.
RuntimeException | if 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.
IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. |
RuntimeException | if 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.
IllegalMonitorStateException | - if the current thread is not the owner of the the Synchronizable Object. |
RuntimeException | if 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.
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.
RuntimeException | if an error occurs while locking the object. |
Implements decaf::util::concurrent::Synchronizable.
virtual void decaf::io::OutputStream::unlock | ( | ) | [inline, virtual] |
Unlocks the object.
RuntimeException | if 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.
RuntimeException | if an error occurs while waiting on the object. |
InterruptedException | if 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.
millisecs | the time in milliseconds to wait, or WAIT_INIFINITE |
RuntimeException | if an error occurs while waiting on the object. |
InterruptedException | if 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.
millisecs | the time in milliseconds to wait, or WAIT_INIFINITE |
nanos | additional time in nanoseconds with a range of 0-999999 |
IllegalArgumentException | if an error occurs or the nanos argument is not in the range of [0-999999] |
RuntimeException | if an error occurs while waiting on the object. |
InterruptedException | if 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.
c | The byte to write to the sink. |
IOException | if 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.
buffer | The vector of bytes to write. |
size | The size of the buffer passed. |
IOException | if an I/O error occurs. |
NullPointerException | thrown if buffer is Null. |
IndexOutOfBoundsException | if 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.
buffer | The array of bytes to write. |
size | The size of the buffer array passed. |
offset | The position to start writing in buffer. |
length | The number of bytes from the buffer to be written. |
IOException | if an I/O error occurs. |
NullPointerException | thrown if buffer is Null. |
IndexOutOfBoundsException | if the offset + length > size. or one of the parameters is negative. |