protected static class SysStreamLogger.LoggingOutputStream
extends java.io.OutputStream
Modifier and Type | Field and Description |
---|---|
protected byte[] |
buf
The internal buffer where data is stored.
|
protected 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.
|
protected boolean |
hasBeenClosed
Used to maintain the contract of
close() . |
protected boolean |
isError |
protected org.slf4j.Logger |
log |
Modifier | Constructor and Description |
---|---|
protected |
LoggingOutputStream() |
|
LoggingOutputStream(org.slf4j.Logger log,
boolean isError)
Creates the LoggingOutputStream to flush to the given Category.
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected void |
reset() |
void |
write(int b)
Writes the specified byte to this output stream.
|
protected org.slf4j.Logger log
protected boolean isError
protected boolean hasBeenClosed
close()
.protected byte[] buf
protected int count
protected int bufLength
public static final int DEFAULT_BUFFER_LENGTH
protected LoggingOutputStream()
public LoggingOutputStream(org.slf4j.Logger log, boolean isError) throws java.lang.IllegalArgumentException
log
- the Logger to write toisError
- the if true write to error, else infojava.lang.IllegalArgumentException
- if cat == null or priority == nullpublic void close()
close
is that it closes the output stream. A closed
stream cannot perform output operations and cannot be reopened.close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
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.write
in class java.io.OutputStream
b
- the byte
to writejava.io.IOException
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.flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
protected void reset()