activemq::io::BufferedOutputStream Class Reference

#include <BufferedOutputStream.h>

Inheritance diagram for activemq::io::BufferedOutputStream:

activemq::io::OutputStream activemq::concurrent::Synchronizable List of all members.

Public Member Functions

 BufferedOutputStream (OutputStream *stream)
 BufferedOutputStream (OutputStream *stream, const int bufSize)
virtual ~BufferedOutputStream ()
virtual void lock () throw ( exceptions::ActiveMQException )
virtual void unlock () throw ( exceptions::ActiveMQException )
virtual void wait () throw ( exceptions::ActiveMQException )
virtual void wait (unsigned long millisecs) throw ( exceptions::ActiveMQException )
virtual void notify () throw ( exceptions::ActiveMQException )
virtual void notifyAll () throw ( exceptions::ActiveMQException )
virtual void write (const unsigned char c) throw ( IOException )
virtual void write (const unsigned char *buffer, const int len) throw ( IOException )
virtual void flush () throw ( IOException )
void close () throw ( cms::CMSException )

Private Member Functions

void init (OutputStream *stream, const int bufSize)
void emptyBuffer () throw ( IOException )

Private Attributes

OutputStreamstream
unsigned char * buffer
int bufferSize
int head
int tail

Detailed Description

Wrapper around another output stream that buffers output before writing to the target output stream.


Constructor & Destructor Documentation

BufferedOutputStream::BufferedOutputStream OutputStream stream  ) 
 

Constructor.

Parameters:
stream the target output stream.

BufferedOutputStream::BufferedOutputStream OutputStream stream,
const int  bufSize
 

Constructor

Parameters:
stream the target output stream.
bufSize the size for the internal buffer.

BufferedOutputStream::~BufferedOutputStream  )  [virtual]
 


Member Function Documentation

void BufferedOutputStream::close  )  throw ( cms::CMSException )
 

Invokes close on the target output stream.

Exceptions:
CMSException thrown if an error occurs.

void BufferedOutputStream::emptyBuffer  )  throw ( IOException ) [private]
 

Writes the contents of the buffer to the output stream.

void BufferedOutputStream::flush  )  throw ( IOException ) [virtual]
 

Invokes flush on the target output stream.

Exceptions:
IOException thrown if an error occurs.

Implements activemq::io::OutputStream.

void BufferedOutputStream::init OutputStream stream,
const int  bufSize
[private]
 

Initializes the internal structures.

virtual void activemq::io::BufferedOutputStream::lock  )  throw ( exceptions::ActiveMQException ) [inline, virtual]
 

Locks the object.

Exceptions:
ActiveMQException 

Implements activemq::concurrent::Synchronizable.

virtual void activemq::io::BufferedOutputStream::notify  )  throw ( exceptions::ActiveMQException ) [inline, virtual]
 

Signals a waiter on this object that it can now wake up and continue. Must have this object locked before calling.

Exceptions:
ActiveMQException 

Implements activemq::concurrent::Synchronizable.

virtual void activemq::io::BufferedOutputStream::notifyAll  )  throw ( exceptions::ActiveMQException ) [inline, virtual]
 

Signals the waiters on this object that it can now wake up and continue. Must have this object locked before calling.

Exceptions:
ActiveMQException 

Implements activemq::concurrent::Synchronizable.

virtual void activemq::io::BufferedOutputStream::unlock  )  throw ( exceptions::ActiveMQException ) [inline, virtual]
 

Unlocks the object.

Exceptions:
ActiveMQException 

Implements activemq::concurrent::Synchronizable.

virtual void activemq::io::BufferedOutputStream::wait unsigned long  millisecs  )  throw ( exceptions::ActiveMQException ) [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:
millisecs time in millisecsonds to wait, or WAIT_INIFINITE
Exceptions:
ActiveMQException 

Implements activemq::concurrent::Synchronizable.

virtual void activemq::io::BufferedOutputStream::wait  )  throw ( exceptions::ActiveMQException ) [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:
ActiveMQException 

Implements activemq::concurrent::Synchronizable.

void BufferedOutputStream::write const unsigned char *  buffer,
const int  len
throw ( IOException ) [virtual]
 

Writes an array of bytes to the output stream.

Parameters:
buffer The array of bytes to write.
len The number of bytes from the buffer to be written.
Exceptions:
IOException thrown if an error occurs.

Implements activemq::io::OutputStream.

void BufferedOutputStream::write const unsigned char  c  )  throw ( IOException ) [virtual]
 

Writes a single byte to the output stream.

Parameters:
c the byte.
Exceptions:
IOException thrown if an error occurs.

Implements activemq::io::OutputStream.


Member Data Documentation

unsigned char* activemq::io::BufferedOutputStream::buffer [private]
 

The internal buffer.

int activemq::io::BufferedOutputStream::bufferSize [private]
 

The size of the internal buffer.

int activemq::io::BufferedOutputStream::head [private]
 

The current head of the buffer.

OutputStream* activemq::io::BufferedOutputStream::stream [private]
 

The target output stream.

int activemq::io::BufferedOutputStream::tail [private]
 

The current tail of the buffer.


The documentation for this class was generated from the following files:
Generated on Thu Aug 3 18:03:33 2006 for activemq-cpp by  doxygen 1.4.5