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 aWriteror aLogger.
-
-
Field Summary
-
Fields inherited from class java.io.PrintWriter
out
-
-
Constructor Summary
Constructors Constructor Description LogPrintWriter(Writer out)Creates a newLogPrintWriterwhich is based on aWriter.LogPrintWriter(org.slf4j.Logger log)Creates a newLogPrintWriterwhich is based on aLogger.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()voidprintln()voidsetLogger(org.slf4j.Logger log)Sets a newLogger.voidsetWriter(Writer out)Sets a new outputWriter.voidwrite(char[] cbuf, int off, int len)voidwrite(int c)voidwrite(String str, int off, int len)
-
-
-
Constructor Detail
-
LogPrintWriter
public LogPrintWriter(Writer out)
Creates a newLogPrintWriterwhich is based on aWriter.- Parameters:
out- the baseWriter.
-
LogPrintWriter
public LogPrintWriter(org.slf4j.Logger log)
Creates a newLogPrintWriterwhich 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 thisLogPrintWriterbefore the newWriteroutis set.- Parameters:
out- theWriterto use for output.
-
setLogger
public void setLogger(org.slf4j.Logger log)
Sets a newLogger. Calling this method will flush thisLogPrintWriterbefore the newLoggeris set.- Parameters:
log- the newLoggerto use for output.
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classPrintWriter
-
flush
public void flush()
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classPrintWriter
-
write
public void write(int c)
- Overrides:
writein classPrintWriter
-
write
public void write(char[] cbuf, int off, int len)- Overrides:
writein classPrintWriter
-
write
public void write(String str, int off, int len)
- Overrides:
writein classPrintWriter
-
println
public void println()
- Overrides:
printlnin classPrintWriter
-
-