1 19 20 21 package org.apache.slide.webdav.logger; 22 23 import java.io.PrintWriter ; 24 import java.io.Writer ; 25 26 37 public class XServletWriterFacade extends PrintWriter { 38 39 protected static final int DEFAULT_BUFFER_SIZE = 8*1024; 40 int defaultBufferSize = DEFAULT_BUFFER_SIZE; 41 int bytesWritten = 0; 42 43 45 public StringBuffer buffer; 46 47 public XServletWriterFacade( Writer w ) { 48 super( w ); 49 buffer = new StringBuffer (); 51 } 52 53 55 public void flush() { 56 super.flush(); 57 } 58 59 public void print( String str ) { 60 buffer = buffer.append(str); 61 super.print( str ); 62 } 63 64 public void println( String str ) { 65 buffer = buffer.append(str + "\n"); 66 super.println( str ); 67 } 68 69 public void write( char buf[], int offset, int count ) { 70 buffer = buffer.append( buf, offset, count ); 71 super.write( buf, offset, count ); 72 } 73 74 public void write( String str ) { 75 buffer = buffer.append(str); 76 super.write( str ); 77 } 78 79 public String getOutputBuffer() { 80 return buffer.toString(); 81 } 82 83 } 84 85 | Popular Tags |