org.oddjob.logging
Class AbstractLoggingOutput

java.lang.Object
  extended by java.io.OutputStream
      extended by org.oddjob.logging.AbstractLoggingOutput
All Implemented Interfaces:
Closeable, Flushable
Direct Known Subclasses:
Log4jPrintStream, LoggingOutputStream

public abstract class AbstractLoggingOutput
extends OutputStream

An output stream that splits output into an existing output stream if supplied, and a console archive.

The internal buffer is synchronised so this class is thread safe, however no synchronisation occurs between writing to the underlying stream and the log so output could be in a different order.


Constructor Summary
AbstractLoggingOutput(OutputStream existing)
          Constructor.
 
Method Summary
 void close()
           
protected abstract  void dispatch(String message)
           
 void flush()
           
 void write(byte[] b)
           
 void write(byte[] buf, int off, int len)
           
 void write(int c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLoggingOutput

public AbstractLoggingOutput(OutputStream existing)
Constructor.

Parameters:
existing - The output stream to also write to. May be null.
level - The level to use when logging.
consoleArchiver - The logger to write to.
Method Detail

write

public void write(int c)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] b)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] buf,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException

dispatch

protected abstract void dispatch(String message)