1
2
3
4
5
6
7
8
9
10
11
12
13 package org.abstracthorizon.mercury.common.io;
14
15 import java.io.IOException;
16 import java.io.OutputStream;
17
18
19
20
21
22
23 public class StreamSplitter extends OutputStream {
24
25
26 protected OutputStream stream1;
27
28
29 protected OutputStream stream2;
30
31
32
33
34
35
36 public StreamSplitter(OutputStream stream1, OutputStream stream2) {
37 this.stream1 = stream1;
38 this.stream2 = stream2;
39 }
40
41 @Override
42 public void write(int b) throws IOException {
43 stream1.write(b);
44 stream2.write(b);
45 }
46
47 @Override
48 public void write(byte[] b) throws IOException {
49 stream1.write(b);
50 stream2.write(b);
51 }
52
53 @Override
54 public void write(byte[] b, int o, int l) throws IOException {
55 stream1.write(b, o, l);
56 stream2.write(b, o, l);
57 }
58
59 }