planetj.servlet.wrapper
Class ServletOutputStreamBuffer

java.lang.Object
  extended byServletOutputStream
      extended byplanetj.servlet.wrapper.ServletOutputStreamBuffer
All Implemented Interfaces:
Buffer

public class ServletOutputStreamBuffer
extends ServletOutputStream
implements Buffer

See Also:
Serialized Form

Constructor Summary
ServletOutputStreamBuffer(java.lang.String charset)
           
 
Method Summary
 java.io.Reader getAsReader()
          Produces a reader of the buffered data.
 java.lang.String getAsString()
          Produces the buffered data in string form.
 boolean prefersReader()
          It's always more efficient to use a reader because the buffer need not be copied.
 int size()
           
 void write(int b)
          Overriden from ServletOutputStream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletOutputStreamBuffer

public ServletOutputStreamBuffer(java.lang.String charset)
Parameters:
charset - - if null, default character encoding is assumed.
Method Detail

getAsReader

public java.io.Reader getAsReader()
                           throws java.io.UnsupportedEncodingException
Description copied from interface: Buffer
Produces a reader of the buffered data.

Specified by:
getAsReader in interface Buffer
Throws:
java.io.UnsupportedEncodingException

getAsString

public java.lang.String getAsString()
                             throws java.io.UnsupportedEncodingException
Description copied from interface: Buffer
Produces the buffered data in string form.

Specified by:
getAsString in interface Buffer
Throws:
java.io.UnsupportedEncodingException

prefersReader

public boolean prefersReader()
It's always more efficient to use a reader because the buffer need not be copied.

Specified by:
prefersReader in interface Buffer

size

public int size()
Specified by:
size in interface Buffer
Returns:
the number of bytes or characters in the buffer.

write

public void write(int b)
           throws java.io.IOException
Overriden from ServletOutputStream

Throws:
java.io.IOException