|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
org.x4juli.global.LoggingOutputStream
Delegates a System.out or System.err to a logger. By default, the original output will be sent to System.out or System.err. This behavior can be turned off with care (avoiding a circle of ConsoleHandler output and LoggingOutstream input to the logging system.
| Field Summary | |
protected byte[] |
buf
The internal buffer where data is stored. |
private int |
bufLength
Remembers the size of the buffer for speed. |
protected int |
count
The number of valid bytes in the buffer. |
static int |
DEFAULT_BUFFER_LENGTH
The default number of bytes in the buffer. =2048 |
protected boolean |
hasBeenClosed
Used to maintain the contract of close(). |
protected java.util.logging.Level |
level
The level to use when writing to the Category. |
protected java.util.logging.Logger |
logger
The Logger to write to. |
| Constructor Summary | |
private |
LoggingOutputStream()
|
|
LoggingOutputStream(java.util.logging.Logger logger,
java.util.logging.Level level)
Creates the LoggingOutputStream to flush to the given Category. |
| Method Summary | |
void |
close()
Closes this output stream and releases any system resources associated with this stream. |
void |
flush()
Flushes this output stream and forces any buffered output bytes to be written out. |
private void |
reset()
|
void |
write(int b)
Writes the specified byte to this output stream. |
| Methods inherited from class java.io.OutputStream |
write, write |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected boolean hasBeenClosed
close().
protected byte[] buf
protected int count
private int bufLength
public static final int DEFAULT_BUFFER_LENGTH
protected java.util.logging.Logger logger
protected java.util.logging.Level level
| Constructor Detail |
private LoggingOutputStream()
public LoggingOutputStream(java.util.logging.Logger logger,
java.util.logging.Level level)
throws java.lang.IllegalArgumentException
logger - the Logger to write tolevel - the Level to use when writing to the Category
java.lang.IllegalArgumentException - if cat == null or priority == null| Method Detail |
public void close()
close is that it
closes the output stream. A closed stream cannot perform output
operations and cannot be reopened.
public void write(int b)
throws java.io.IOException
write is that one byte is written to the output stream.
The byte to be written is the eight low-order bits of the argument
b. The 24 high-order bits of b are
ignored.
b - the byte to write
java.io.IOException - if an I/O error occurs. In particular, an
IOException may be thrown if the output
stream has been closed.public void flush()
flush is that calling
it is an indication that, if any bytes previously written have been
buffered by the implementation of the output stream, such bytes should
immediately be written to their intended destination.
private void reset()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||