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.
-
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidclose()Taken fromWritervoidflush()Taken fromWriterGet the underlying buffer for the writerBecause writer is a class and not an interface we need a way to self reference so we can pass the underlying Writer onto other Writers.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) voidvoidvoidvoidwrite(char[] buf) Taken fromWritervoidwrite(char[] buf, int off, int len) Taken fromWritervoidwrite(int c) Taken fromWritervoidTaken fromWritervoidTaken fromWriterbooleanwriteSitemeshBufferFragment(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, setErrorMethods inherited from class java.io.Writer
nullWriter
-
Constructor Details
-
RoutablePrintWriter
-
-
Method Details
-
updateDestination
-
getUnderlyingWriter
Description copied from interface:SitemeshWriterBecause writer is a class and not an interface we need a way to self reference so we can pass the underlying Writer onto other Writers.- Specified by:
getUnderlyingWriterin interfaceSitemeshWriter- Returns:
- a self reference to this so it can be wrapped say.
-
close
public void close()Description copied from interface:SitemeshWriterTaken fromWriter- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceSitemeshWriter- 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
Description copied from interface:SitemeshWriterTaken fromWriter- Specified by:
writein interfaceSitemeshWriter- Overrides:
writein classPrintWriter- Parameters:
s- the characters to write
-
write
Description copied from interface:SitemeshWriterTaken fromWriter- Specified by:
writein interfaceSitemeshWriter- Overrides:
writein classPrintWriter- Parameters:
s- the characters to writeoff- the offset to write fromlen- the length to write
-
write
public void write(char[] buf) Description copied from interface:SitemeshWriterTaken fromWriter- Specified by:
writein interfaceSitemeshWriter- Overrides:
writein classPrintWriter- Parameters:
buf- the characters to write
-
write
public void write(char[] buf, int off, int len) Description copied from interface:SitemeshWriterTaken fromWriter- Specified by:
writein interfaceSitemeshWriter- Overrides:
writein classPrintWriter- Parameters:
buf- the characters to writeoff- the offset to write fromlen- the length to write
-
write
public void write(int c) Description copied from interface:SitemeshWriterTaken fromWriter- Specified by:
writein interfaceSitemeshWriter- Overrides:
writein classPrintWriter- Parameters:
c- the character to write
-
checkError
public boolean checkError()- Overrides:
checkErrorin classPrintWriter
-
flush
public void flush()Description copied from interface:SitemeshWriterTaken fromWriter- Specified by:
flushin interfaceFlushable- Specified by:
flushin interfaceSitemeshWriter- 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
-