Class LogOutputStream

  • All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

    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.
    Version:
    $Id: LogOutputStream.java 1636056 2014-11-01 21:12:52Z ggregory $
    • Constructor Detail

      • LogOutputStream

        public LogOutputStream()
        Creates a new instance of this class. Uses the default level of 999.
      • LogOutputStream

        public LogOutputStream​(int level)
        Creates a new instance of this class.
        Parameters:
        level - loglevel used to log data written to this stream.
    • Method Detail

      • getMessageLevel

        public int getMessageLevel()
        Returns:
        the trace level of the log system
      • write

        public void write​(byte[] b,
                          int off,
                          int len)
                   throws IOException
        Write a block of characters to the output stream
        Overrides:
        write in class OutputStream
        Parameters:
        b - the array containing the data
        off - the offset into the array where data starts
        len - the length of block
        Throws:
        IOException - if the data cannot be written into the stream.
        See Also:
        OutputStream.write(byte[], int, int)
      • processBuffer

        protected void processBuffer()
        Converts the buffer to a string and sends it to processLine.
      • processLine

        protected void processLine​(String line)
        Logs a line to the log system of the user.
        Parameters:
        line - the line to log.
      • processLine

        protected abstract void processLine​(String line,
                                            int logLevel)
        Logs a line to the log system of the user.
        Parameters:
        line - the line to log.
        logLevel - the log level to use