KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > cache > MultiplexServletOutputStream


1 package info.magnolia.cms.cache;
2
3 import java.io.IOException JavaDoc;
4 import java.io.OutputStream JavaDoc;
5
6 import javax.servlet.ServletOutputStream JavaDoc;
7
8
9 /**
10  * A simple ServletOutputStream implementation that duplicates any output to two different output stream.
11  * @author Fabrizio Giustina
12  * @version $Revision: 6341 $ ($Author: philipp $)
13  */

14 public class MultiplexServletOutputStream extends ServletOutputStream JavaDoc {
15
16     OutputStream JavaDoc stream1;
17
18     OutputStream JavaDoc stream2;
19
20     public MultiplexServletOutputStream(OutputStream JavaDoc stream1, OutputStream JavaDoc stream2) {
21         this.stream1 = stream1;
22         this.stream2 = stream2;
23     }
24
25     public void write(int value) throws IOException JavaDoc {
26         stream1.write(value);
27         stream2.write(value);
28     }
29
30     public void write(byte[] value) throws IOException JavaDoc {
31         stream1.write(value);
32         stream2.write(value);
33     }
34
35     public void write(byte[] b, int off, int len) throws IOException JavaDoc {
36         stream1.write(b, off, len);
37         stream2.write(b, off, len);
38     }
39 }
40
Popular Tags