Package org.apache.jackrabbit.test
Class LogPrintWriter
- java.lang.Object
-
- java.io.Writer
-
- java.io.PrintWriter
-
- org.apache.jackrabbit.test.LogPrintWriter
-
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
public class LogPrintWriter extends PrintWriter
Implements a PrintWriter which allows to alternatively plug in aWriter
or aLogger
.
-
-
Field Summary
-
Fields inherited from class java.io.PrintWriter
out
-
-
Constructor Summary
Constructors Constructor Description LogPrintWriter(Writer out)
Creates a newLogPrintWriter
which is based on aWriter
.LogPrintWriter(org.slf4j.Logger log)
Creates a newLogPrintWriter
which is based on aLogger
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
void
println()
void
setLogger(org.slf4j.Logger log)
Sets a newLogger
.void
setWriter(Writer out)
Sets a new outputWriter
.void
write(char[] cbuf, int off, int len)
void
write(int c)
void
write(String str, int off, int len)
-
Methods inherited from class java.io.PrintWriter
append, append, append, checkError, clearError, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, setError, write, write
-
Methods inherited from class java.io.Writer
nullWriter
-
-
-
-
Constructor Detail
-
LogPrintWriter
public LogPrintWriter(Writer out)
Creates a newLogPrintWriter
which is based on aWriter
.- Parameters:
out
- the baseWriter
.
-
LogPrintWriter
public LogPrintWriter(org.slf4j.Logger log)
Creates a newLogPrintWriter
which is based on aLogger
.- Parameters:
log
- the baseLogger
.
-
-
Method Detail
-
setWriter
public void setWriter(Writer out)
Sets a new outputWriter
. Calling this method will flush thisLogPrintWriter
before the newWriter
out
is set.- Parameters:
out
- theWriter
to use for output.
-
setLogger
public void setLogger(org.slf4j.Logger log)
Sets a newLogger
. Calling this method will flush thisLogPrintWriter
before the newLogger
is set.- Parameters:
log
- the newLogger
to use for output.
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classPrintWriter
-
flush
public void flush()
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classPrintWriter
-
write
public void write(int c)
- Overrides:
write
in classPrintWriter
-
write
public void write(char[] cbuf, int off, int len)
- Overrides:
write
in classPrintWriter
-
write
public void write(String str, int off, int len)
- Overrides:
write
in classPrintWriter
-
println
public void println()
- Overrides:
println
in classPrintWriter
-
-