KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hudson > util > DualOutputStream


1 package hudson.util;
2
3 import java.io.IOException JavaDoc;
4 import java.io.OutputStream JavaDoc;
5
6 /**
7  * @author Kohsuke Kawaguchi
8  */

9 public class DualOutputStream extends OutputStream JavaDoc {
10     private final OutputStream JavaDoc lhs,rhs;
11
12     public DualOutputStream(OutputStream JavaDoc lhs, OutputStream JavaDoc rhs) {
13         this.lhs = lhs;
14         this.rhs = rhs;
15     }
16
17     public void write(int b) throws IOException JavaDoc {
18         lhs.write(b);
19         rhs.write(b);
20     }
21
22     public void write(byte[] b) throws IOException JavaDoc {
23         lhs.write(b);
24         rhs.write(b);
25     }
26
27     public void write(byte[] b, int off, int len) throws IOException JavaDoc {
28         lhs.write(b,off,len);
29         rhs.write(b,off,len);
30     }
31
32     public void flush() throws IOException JavaDoc {
33         lhs.flush();
34         rhs.flush();
35     }
36
37     public void close() throws IOException JavaDoc {
38         lhs.close();
39         rhs.close();
40     }
41 }
42
Popular Tags