Package com.identityworksllc.iiq.common
Class CommonsLoggingOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.identityworksllc.iiq.common.CommonsLoggingOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class CommonsLoggingOutputStream extends OutputStream
Implements an OutputStream that will write to the given logger whenever any newline is encountered.The output is buffered until a newline.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CommonsLoggingOutputStream.Level
A representation of the log level
-
Constructor Summary
Constructors Constructor Description CommonsLoggingOutputStream(CommonsLoggingOutputStream.Level level, org.apache.commons.logging.Log logger)
Constructs a new OutputStream that will write to the given logger at the given level whenever a newline is encountered in the byte stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
flush()
Flushes the output stream.void
write(int b)
Writes a byte to the output stream.-
Methods inherited from class java.io.OutputStream
close, nullOutputStream, write, write
-
-
-
-
Constructor Detail
-
CommonsLoggingOutputStream
public CommonsLoggingOutputStream(CommonsLoggingOutputStream.Level level, org.apache.commons.logging.Log logger)
Constructs a new OutputStream that will write to the given logger at the given level whenever a newline is encountered in the byte stream.- Parameters:
level
- The log levellogger
- The logger to write to
-
-
Method Detail
-
write
public void write(int b)
Writes a byte to the output stream.This method flushes automatically at the end of a line.
- Specified by:
write
in classOutputStream
- See Also:
OutputStream.write(int)
-
flush
public void flush()
Flushes the output stream.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- See Also:
OutputStream.flush()
-
-