public abstract class LogOutputStream
extends java.io.OutputStream
Modifier and Type | Field and Description |
---|---|
private java.io.ByteArrayOutputStream |
buffer
the internal buffer
|
private static int |
CR
Carriage return
|
private static int |
INTIAL_SIZE
Initial buffer size.
|
private int |
level |
private static int |
LF
Linefeed
|
private boolean |
skip |
Constructor and Description |
---|
LogOutputStream()
Creates a new instance of this class.
|
LogOutputStream(int level)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Writes all remaining data from the buffer.
|
void |
flush()
Flush this log stream.
|
int |
getMessageLevel() |
protected void |
processBuffer()
Converts the buffer to a string and sends it to
processLine . |
protected void |
processLine(java.lang.String line)
Logs a line to the log system of the user.
|
protected abstract void |
processLine(java.lang.String line,
int logLevel)
Logs a line to the log system of the user.
|
void |
write(byte[] b,
int off,
int len)
Write a block of characters to the output stream
|
void |
write(int cc)
Write the data to the buffer and flush the buffer, if a line separator is
detected.
|
private static final int INTIAL_SIZE
private static final int CR
private static final int LF
private final java.io.ByteArrayOutputStream buffer
private boolean skip
private final int level
public LogOutputStream()
public LogOutputStream(int level)
level
- loglevel used to log data written to this stream.public void write(int cc) throws java.io.IOException
write
in class java.io.OutputStream
cc
- data to log (byte).java.io.IOException
OutputStream.write(int)
public void flush()
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
OutputStream.flush()
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
OutputStream.close()
public int getMessageLevel()
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
b
- the array containing the dataoff
- the offset into the array where data startslen
- the length of blockjava.io.IOException
- if the data cannot be written into the stream.OutputStream.write(byte[], int, int)
protected void processBuffer()
processLine
.protected void processLine(java.lang.String line)
line
- the line to log.protected abstract void processLine(java.lang.String line, int logLevel)
line
- the line to log.logLevel
- the log level to use