|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| package org.apache.tapestry.util.io; |
|
16 |
| |
|
17 |
| import java.io.IOException; |
|
18 |
| import java.io.OutputStream; |
|
19 |
| |
|
20 |
| import org.apache.hivemind.util.Defense; |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| public class TeeOutputStream extends OutputStream |
|
29 |
| { |
|
30 |
| private final OutputStream _os1; |
|
31 |
| |
|
32 |
| private final OutputStream _os2; |
|
33 |
| |
|
34 |
66
| public TeeOutputStream(OutputStream os1, OutputStream os2)
|
|
35 |
| { |
|
36 |
66
| Defense.notNull(os1, "os1");
|
|
37 |
66
| Defense.notNull(os2, "os2");
|
|
38 |
| |
|
39 |
66
| _os1 = os1;
|
|
40 |
66
| _os2 = os2;
|
|
41 |
| } |
|
42 |
| |
|
43 |
63
| public void close() throws IOException
|
|
44 |
| { |
|
45 |
63
| _os1.close();
|
|
46 |
63
| _os2.close();
|
|
47 |
| } |
|
48 |
| |
|
49 |
189
| public void flush() throws IOException
|
|
50 |
| { |
|
51 |
189
| _os1.flush();
|
|
52 |
189
| _os2.flush();
|
|
53 |
| } |
|
54 |
| |
|
55 |
63
| public void write(byte[] b, int off, int len) throws IOException
|
|
56 |
| { |
|
57 |
63
| _os1.write(b, off, len);
|
|
58 |
63
| _os2.write(b, off, len);
|
|
59 |
| } |
|
60 |
| |
|
61 |
0
| public void write(byte[] b) throws IOException
|
|
62 |
| { |
|
63 |
0
| _os1.write(b);
|
|
64 |
0
| _os1.write(b);
|
|
65 |
| } |
|
66 |
| |
|
67 |
0
| public void write(int b) throws IOException
|
|
68 |
| { |
|
69 |
0
| _os1.write(b);
|
|
70 |
0
| _os2.write(b);
|
|
71 |
| } |
|
72 |
| } |