Class LogOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.terracotta.angela.common.util.LogOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
- Direct Known Subclasses:
TriggeringOutputStream
public abstract class LogOutputStream extends OutputStream
Base class to connect a logging system to the output and/or error stream of then external process. The implementation parses the incoming data to construct a line and passes the complete line to an user-defined implementation.
-
-
Constructor Summary
Constructors Constructor Description LogOutputStream()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Writes all remaining data from the buffer.voidflush()Flush this log stream.protected voidprocessBuffer()Converts the buffer to a string and sends it toprocessLine.protected abstract voidprocessLine(String line)Logs a line to the log system of the user.voidwrite(int cc)Write the data to the buffer and flush the buffer, if a line separator is detected.-
Methods inherited from class java.io.OutputStream
nullOutputStream, write, write
-
-
-
-
Method Detail
-
write
public void write(int cc) throws IOExceptionWrite the data to the buffer and flush the buffer, if a line separator is detected.- Specified by:
writein classOutputStream- Parameters:
cc- data to log (byte).- Throws:
IOException- See Also:
OutputStream.write(int)
-
flush
public void flush()
Flush this log stream.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- See Also:
OutputStream.flush()
-
close
public void close() throws IOExceptionWrites all remaining data from the buffer.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException- See Also:
OutputStream.close()
-
processBuffer
protected void processBuffer()
Converts the buffer to a string and sends it toprocessLine.
-
processLine
protected abstract void processLine(String line)
Logs a line to the log system of the user.- Parameters:
line- the line to log.
-
-