blob: 2a1af999065fd4987c15062a18899aad83905f0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package cz.crcs.ectester.reader.output;
import java.io.IOException;
import java.io.OutputStream;
/**
* @author Jan Jancar johny@neuromancer.sk
*/
public class TeeOutputStream extends OutputStream {
private OutputStream[] outputs;
public TeeOutputStream(OutputStream... outputs) {
this.outputs = outputs;
}
@Override
public void write(int b) throws IOException {
for (OutputStream out : outputs) {
out.write(b);
}
}
@Override
public void flush() throws IOException {
for (OutputStream out : outputs) {
out.flush();
}
}
@Override
public void close() throws IOException {
for (OutputStream out : outputs) {
out.close();
}
}
}
|