public class LoggerOutputStream
extends java.io.OutputStream
final LoggerOutputStream outputStream = new LoggerOutputStream( logger, Priority.DEBUG ); final PrintStream output = new PrintStream( outputStream, true ); System.setOut( output );
Modifier and Type | Field and Description |
---|---|
private boolean |
m_closed |
private Logger |
m_logger |
private java.lang.StringBuffer |
m_output |
private Priority |
m_priority |
Constructor and Description |
---|
LoggerOutputStream(Logger logger,
Priority priority)
Construct OutputStreamLogger to write to a particular logger at a particular priority.
|
Modifier and Type | Method and Description |
---|---|
private void |
checkValid()
Make sure stream is valid.
|
void |
close()
Shutdown stream.
|
void |
flush()
Flush data to underlying logger.
|
void |
write(int data)
Write a single byte of data to output stream.
|
private final Logger m_logger
private final Priority m_priority
private final java.lang.StringBuffer m_output
private boolean m_closed
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
- if an error occurs while closing the streampublic void write(int data) throws java.io.IOException
write
in class java.io.OutputStream
data
- the byte of datajava.io.IOException
- if an error occurspublic void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
- if an error occursprivate void checkValid() throws java.io.IOException
java.io.IOException
- if an error occurs