Class RoutablePrintWriter
java.lang.Object
java.io.Writer
java.io.PrintWriter
com.opensymphony.module.sitemesh.filter.RoutablePrintWriter
- All Implemented Interfaces:
SitemeshWriter,Closeable,Flushable,Appendable,AutoCloseable
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.
- Author:
- Joe Walnes
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFactory to lazily instantiate the destination. -
Field Summary
Fields inherited from class java.io.PrintWriter
out -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new routable print writer. -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidclose()voidflush()Get the underlying buffer for the writer.voidprint(boolean b) voidprint(char c) voidprint(char[] s) voidprint(double d) voidprint(float f) voidprint(int i) voidprint(long l) voidvoidvoidprintln()voidprintln(boolean x) voidprintln(char x) voidprintln(char[] x) voidprintln(double x) voidprintln(float x) voidprintln(int x) voidprintln(long x) voidvoidvoidUpdate destination.voidwrite(char[] buf) voidwrite(char[] buf, int off, int len) voidwrite(int c) voidvoidbooleanwriteSitemeshBufferFragment(SitemeshBufferFragment bufferFragment) Write a sitemesh buffer fragment to the writer.Methods inherited from class java.io.PrintWriter
append, append, append, clearError, format, format, printf, printf, setError
-
Constructor Details
-
RoutablePrintWriter
Instantiates a new routable print writer.- Parameters:
factory- the factory
-
-
Method Details
-
updateDestination
Update destination.- Parameters:
factory- the factory
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classPrintWriter
-
println
- Overrides:
printlnin classPrintWriter
-
println
- 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
- Overrides:
printin classPrintWriter
-
print
- 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
- Overrides:
writein classPrintWriter
-
write
- 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
-
writeSitemeshBufferFragment
public boolean writeSitemeshBufferFragment(SitemeshBufferFragment bufferFragment) throws IOException Description copied from interface:SitemeshWriterWrite a sitemesh buffer fragment to the writer. This may not be written immediately, it may be stored and written later, when this buffer is written out to a writer.- Specified by:
writeSitemeshBufferFragmentin interfaceSitemeshWriter- Parameters:
bufferFragment- The buffer fragment to write- Returns:
- True if the buffer was written immediately, or false if it will be written later
- Throws:
IOException- If an IOException occurred
-
getSitemeshBuffer
Description copied from interface:SitemeshWriterGet the underlying buffer for the writer.- Specified by:
getSitemeshBufferin interfaceSitemeshWriter- Returns:
- The underlying buffer
-