KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hudson > util > ForkOutputStream


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