1 package org.roller.presentation.pagecache.rollercache; 2 3 import java.io.PrintWriter ; 4 import java.io.Writer ; 5 6 9 public class SplitPrintWriter extends PrintWriter 10 { 11 private PrintWriter captureWriter = null; 12 private PrintWriter passThroughWriter = null; 13 14 public SplitPrintWriter(PrintWriter captureWriter, PrintWriter passThroughWriter) 15 { 16 super(passThroughWriter); 17 this.captureWriter = captureWriter; 18 this.passThroughWriter = passThroughWriter; 19 } 20 21 public void write(char[] cbuf) 22 { 23 captureWriter.write(cbuf); 24 passThroughWriter.write(cbuf); 25 } 26 public void write(char[] cbuf, int off, int len) 27 { 28 captureWriter.write(cbuf,off,len); 29 passThroughWriter.write(cbuf,off,len); 30 } 31 public void write(int c) 32 { 33 captureWriter.write(c); 34 passThroughWriter.write(c); 35 } 36 public void write(String str) 37 { 38 captureWriter.write(str); 39 passThroughWriter.write(str); 40 } 41 public void write(String str, int off, int len) 42 { 43 captureWriter.write(str,off,len); 44 passThroughWriter.write(str,off,len); 45 } 46 public void flush() 47 { 48 captureWriter.flush(); 49 passThroughWriter.flush(); 50 } 51 public void close() 52 { 53 captureWriter.close(); 54 passThroughWriter.close(); 55 } 56 } 57 | Popular Tags |