1 /* 2 * $Id: Buffer.java,v 1.1 2001/12/21 06:50:10 lhoriman Exp $ 3 * $Source: /cvsroot/mav/maverick/src/java/org/infohazard/maverick/util/Buffer.java,v $ 4 */ 5 6 package org.infohazard.maverick.util; 7 8 import java.io.*; 9 10 /** 11 * Simple interface to abstract out both ServletOutputStreams and PrintWriters. 12 */ 13 public interface Buffer 14 { 15 /** 16 * True if it is more efficient to call toReader() than toString(). 17 */ 18 public boolean prefersReader(); 19 20 /** 21 * Produces a reader of the buffered data. 22 */ 23 public Reader getAsReader() throws UnsupportedEncodingException; 24 25 /** 26 * Produces the buffered data in string form. 27 */ 28 public String getAsString() throws UnsupportedEncodingException; 29 30 /** 31 * @return the number of bytes or characters in the buffer. 32 */ 33 public int size(); 34 } 35