Class LogOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class LogOutputStream
    extends java.io.ByteArrayOutputStream
    Many standard components log to OutputStreams. This wrapper class extends the ByteArrayOutputStream class and writes all given data to an underlying Log instance whenever it is flushed and the internally held byte array contains a newline.
    Author:
    Abe White, Marc Prud'hommeaux
    • Field Summary

      • Fields inherited from class java.io.ByteArrayOutputStream

        buf, count
    • Constructor Summary

      Constructors 
      Constructor Description
      LogOutputStream​(Log log, int level)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void flush()  
      • Methods inherited from class java.io.ByteArrayOutputStream

        close, reset, size, toByteArray, toString, toString, toString, toString, write, write, writeBytes, writeTo
      • Methods inherited from class java.io.OutputStream

        nullOutputStream, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • LogOutputStream

        public LogOutputStream​(Log log,
                               int level)
        Constructor.
        Parameters:
        log - the log to log to
        level - the level to log at
    • Method Detail

      • flush

        public void flush()
                   throws java.io.IOException
        Specified by:
        flush in interface java.io.Flushable
        Overrides:
        flush in class java.io.OutputStream
        Throws:
        java.io.IOException