org.infohazard.maverick.util
Interface Buffer

All Known Implementing Classes:
PrintWriterBuffer, ServletOutputStreamBuffer

public interface Buffer

Simple interface to abstract out both ServletOutputStreams and PrintWriters.


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()
          True if it is more efficient to call toReader() than toString().
 int size()
           
 

Method Detail

prefersReader

public boolean prefersReader()
True if it is more efficient to call toReader() than toString().


getAsReader

public java.io.Reader getAsReader()
                           throws java.io.UnsupportedEncodingException
Produces a reader of the buffered data.

java.io.UnsupportedEncodingException

getAsString

public java.lang.String getAsString()
                             throws java.io.UnsupportedEncodingException
Produces the buffered data in string form.

java.io.UnsupportedEncodingException

size

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