Package org.apache.commons.exec
Class LogOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.commons.exec.LogOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
- Direct Known Subclasses:
LoggerOutputStream
public abstract class LogOutputStream extends java.io.OutputStreamBase 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()Creates a new instance of this class.LogOutputStream(int level)Creates a new instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Writes all remaining data from the buffer.voidflush()Flush this log stream.intgetMessageLevel()voidwrite(byte[] b, int off, int len)Write a block of characters to the output streamvoidwrite(int cc)Write the data to the buffer and flush the buffer, if a line separator is detected.
-
-
-
Method Detail
-
write
public void write(int cc) throws java.io.IOExceptionWrite the data to the buffer and flush the buffer, if a line separator is detected.- Specified by:
writein classjava.io.OutputStream- Parameters:
cc- data to log (byte).- Throws:
java.io.IOException- See Also:
OutputStream.write(int)
-
flush
public void flush()
Flush this log stream.- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- See Also:
OutputStream.flush()
-
close
public void close() throws java.io.IOExceptionWrites all remaining data from the buffer.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException- See Also:
OutputStream.close()
-
getMessageLevel
public int getMessageLevel()
- Returns:
- the trace level of the log system
-
write
public void write(byte[] b, int off, int len) throws java.io.IOExceptionWrite a block of characters to the output stream- Overrides:
writein classjava.io.OutputStream- Parameters:
b- the array containing the dataoff- the offset into the array where data startslen- the length of block- Throws:
java.io.IOException- if the data cannot be written into the stream.- See Also:
OutputStream.write(byte[], int, int)
-
-