com.opensymphony.module.sitemesh.filter
Class PageOutputStream
java.lang.Object
java.io.OutputStream
javax.servlet.ServletOutputStream
com.opensymphony.module.sitemesh.filter.PageOutputStream
- All Implemented Interfaces:
- OutputBuffer, Closeable, Flushable
public class PageOutputStream
- extends ServletOutputStream
- implements OutputBuffer
Implementation of ServletOutputStream that stores all data written
to it in a temporary buffer accessible from getBuffer(java.lang.String)
.
- Version:
- $Revision: 1.4 $
- Author:
- Scott Farquhar, Hani Suleiman
Methods inherited from class javax.servlet.ServletOutputStream |
print, print, print, print, print, print, print, println, println, println, println, println, println, println, println |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
buffer
private ByteArrayOutputStream buffer
target
private OutputStream target
DEFAULT_ENCODING
private static final String DEFAULT_ENCODING
JDK14
private static final boolean JDK14
response
private final ServletResponse response
- The reason we use a response, rather than just getting the outputstream directly is that under Tomcat, when
serving static resources, we need to avoid calling getOutputStream() if we are going to use a decorator.
More information: http://marc.theaimsgroup.com/?l=tomcat-user&m=107569601410973&w=2, SIM-74, SIM-82
PageOutputStream
public PageOutputStream(ServletResponse response)
- Construct an OutputStream that will buffer the content written to it.
write
public void write(int b)
throws IOException
- Specified by:
write
in class OutputStream
- Throws:
IOException
discardBuffer
public void discardBuffer()
- Specified by:
discardBuffer
in interface OutputBuffer
get14Buffer
public char[] get14Buffer(String encoding)
trim
private static char[] trim(char[] ca,
int len)
getBuffer
public char[] getBuffer(String encoding)
- Specified by:
getBuffer
in interface OutputBuffer
- Parameters:
encoding
- The encoding to use for decoding the buffer
flush
public void flush()
- Specified by:
flush
in interface OutputBuffer
- Specified by:
flush
in interface Flushable
- Overrides:
flush
in class OutputStream