Package org.apache.syncope.common.lib
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 byorg.apache.commons.exec.LogOutputStream
-
-
Constructor Summary
Constructors Constructor Description LogOutputStream(Logger logger)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Writes all remaining data from the buffer.void
flush()
Flush this log stream.void
write(byte[] b, int off, int len)
Write a block of characters to the output streamvoid
write(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
-
-
-
-
Constructor Detail
-
LogOutputStream
public LogOutputStream(Logger logger)
-
-
Method Detail
-
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 classOutputStream
- Parameters:
cc
- data to log (byte).
-
flush
public void flush()
Flush this log stream.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
-
close
public void close() throws IOException
Writes all remaining data from the buffer.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
- if an I/O error occurs- See Also:
OutputStream.close()
-
write
public void write(byte[] b, int off, int len)
Write a block of characters to the output stream- Overrides:
write
in classOutputStream
- Parameters:
b
- the array containing the dataoff
- the offset into the array where data startslen
- the length of block
-
-