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 |
20
| public TeeOutputStream(OutputStream os1, OutputStream os2)
|
35 |
| { |
36 |
20
| Defense.notNull(os1, "os1");
|
37 |
20
| Defense.notNull(os2, "os2");
|
38 |
| |
39 |
20
| _os1 = os1;
|
40 |
20
| _os2 = os2;
|
41 |
| } |
42 |
| |
43 |
19
| public void close() throws IOException
|
44 |
| { |
45 |
19
| _os1.close();
|
46 |
19
| _os2.close();
|
47 |
| } |
48 |
| |
49 |
57
| public void flush() throws IOException
|
50 |
| { |
51 |
57
| _os1.flush();
|
52 |
57
| _os2.flush();
|
53 |
| } |
54 |
| |
55 |
19
| public void write(byte[] b, int off, int len) throws IOException
|
56 |
| { |
57 |
19
| _os1.write(b, off, len);
|
58 |
19
| _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 |
| } |