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 voidclose()Writes all remaining data from the buffer.voidflush()Flush this log stream.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.-
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:
writein classOutputStream- Parameters:
cc- data to log (byte).
-
flush
public void flush()
Flush this log stream.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream
-
close
public void close() throws IOExceptionWrites all remaining data from the buffer.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein 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:
writein classOutputStream- Parameters:
b- the array containing the dataoff- the offset into the array where data startslen- the length of block
-
-