Class LogOutputStream

java.lang.Object
java.io.OutputStream
org.apache.syncope.common.lib.LogOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class LogOutputStream extends OutputStream implements AutoCloseable
Delegates output stream writing onto an SLF4J logger. Inspired by org.apache.commons.exec.LogOutputStream
  • Constructor Details

    • LogOutputStream

      public LogOutputStream(Logger logger)
  • Method Details

    • write

      public void write(int cc)
      Write the data to the buffer and flush the buffer, if a line separator is detected.
      Specified by:
      write in class OutputStream
      Parameters:
      cc - data to log (byte).
    • flush

      public void flush()
      Flush this log stream.
      Specified by:
      flush in interface Flushable
      Overrides:
      flush in class OutputStream
    • close

      public void close() throws IOException
      Writes all remaining data from the buffer.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class OutputStream
      Throws:
      IOException - if an I/O error occurs
      See Also:
    • write

      public void write(byte[] b, int off, int len)
      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