Class RoutablePrintWriter
- java.lang.Object
-
- java.io.Writer
-
- java.io.PrintWriter
-
- com.opensymphony.module.sitemesh.filter.RoutablePrintWriter
-
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
public class RoutablePrintWriter extends PrintWriter
Provides a PrintWriter that routes through to another PrintWriter, however the destination can be changed at any point. The destination can be passed in using a factory, so it will not be created until it's actually needed.- Version:
- $Revision: 1.1 $
- Author:
- Joe Walnes
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceRoutablePrintWriter.DestinationFactoryFactory to lazily instantiate the destination.private static classRoutablePrintWriter.NullWriterJust to keep super constructor for PrintWriter happy - it's never actually used.
-
Field Summary
Fields Modifier and Type Field Description private PrintWriterdestinationprivate RoutablePrintWriter.DestinationFactoryfactory-
Fields inherited from class java.io.PrintWriter
out
-
-
Constructor Summary
Constructors Constructor Description RoutablePrintWriter(RoutablePrintWriter.DestinationFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckError()voidclose()voidflush()private PrintWritergetDestination()voidprint(boolean b)voidprint(char c)voidprint(char[] s)voidprint(double d)voidprint(float f)voidprint(int i)voidprint(long l)voidprint(Object obj)voidprint(String s)voidprintln()voidprintln(boolean x)voidprintln(char x)voidprintln(char[] x)voidprintln(double x)voidprintln(float x)voidprintln(int x)voidprintln(long x)voidprintln(Object x)voidprintln(String x)voidupdateDestination(RoutablePrintWriter.DestinationFactory factory)voidwrite(char[] buf)voidwrite(char[] buf, int off, int len)voidwrite(int c)voidwrite(String s)voidwrite(String s, int off, int len)-
Methods inherited from class java.io.PrintWriter
append, append, append, clearError, format, format, printf, printf, setError
-
Methods inherited from class java.io.Writer
nullWriter
-
-
-
-
Field Detail
-
destination
private PrintWriter destination
-
factory
private RoutablePrintWriter.DestinationFactory factory
-
-
Constructor Detail
-
RoutablePrintWriter
public RoutablePrintWriter(RoutablePrintWriter.DestinationFactory factory)
-
-
Method Detail
-
getDestination
private PrintWriter getDestination()
-
updateDestination
public void updateDestination(RoutablePrintWriter.DestinationFactory factory)
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classPrintWriter
-
println
public void println(Object x)
- Overrides:
printlnin classPrintWriter
-
println
public void println(String x)
- Overrides:
printlnin classPrintWriter
-
println
public void println(char[] x)
- Overrides:
printlnin classPrintWriter
-
println
public void println(double x)
- Overrides:
printlnin classPrintWriter
-
println
public void println(float x)
- Overrides:
printlnin classPrintWriter
-
println
public void println(long x)
- Overrides:
printlnin classPrintWriter
-
println
public void println(int x)
- Overrides:
printlnin classPrintWriter
-
println
public void println(char x)
- Overrides:
printlnin classPrintWriter
-
println
public void println(boolean x)
- Overrides:
printlnin classPrintWriter
-
println
public void println()
- Overrides:
printlnin classPrintWriter
-
print
public void print(Object obj)
- Overrides:
printin classPrintWriter
-
print
public void print(String s)
- Overrides:
printin classPrintWriter
-
print
public void print(char[] s)
- Overrides:
printin classPrintWriter
-
print
public void print(double d)
- Overrides:
printin classPrintWriter
-
print
public void print(float f)
- Overrides:
printin classPrintWriter
-
print
public void print(long l)
- Overrides:
printin classPrintWriter
-
print
public void print(int i)
- Overrides:
printin classPrintWriter
-
print
public void print(char c)
- Overrides:
printin classPrintWriter
-
print
public void print(boolean b)
- Overrides:
printin classPrintWriter
-
write
public void write(String s)
- Overrides:
writein classPrintWriter
-
write
public void write(String s, int off, int len)
- Overrides:
writein classPrintWriter
-
write
public void write(char[] buf)
- Overrides:
writein classPrintWriter
-
write
public void write(char[] buf, int off, int len)- Overrides:
writein classPrintWriter
-
write
public void write(int c)
- Overrides:
writein classPrintWriter
-
checkError
public boolean checkError()
- Overrides:
checkErrorin classPrintWriter
-
flush
public void flush()
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classPrintWriter
-
-