KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > presentation > pagecache > rollercache > SplitPrintWriter


1 package org.roller.presentation.pagecache.rollercache;
2
3 import java.io.PrintWriter JavaDoc;
4 import java.io.Writer JavaDoc;
5
6 /**
7  * @author Dave Johnson
8  */

9 public class SplitPrintWriter extends PrintWriter JavaDoc
10 {
11     private PrintWriter JavaDoc captureWriter = null;
12     private PrintWriter JavaDoc passThroughWriter = null;
13     
14     public SplitPrintWriter(PrintWriter JavaDoc captureWriter, PrintWriter JavaDoc 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 JavaDoc str)
37     {
38         captureWriter.write(str);
39         passThroughWriter.write(str);
40     }
41     public void write(String JavaDoc 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