blob: 8c99cc956d35a30fb6eb99977ed57ee1cd5208e9 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package bjc.everge;
import java.io.*;
import java.util.*;
public class MirrorOutputStream extends OutputStream {
private List<OutputStream> streams;
public MirrorOutputStream(OutputStream... strams) {
streams = new ArrayList<>();
for (OutputStream stram : strams) {
streams.add(stram);
}
}
@Override
public void close() throws IOException {
for (OutputStream stream : streams) {
stream.close();
}
}
@Override
public void flush() throws IOException {
for (OutputStream stream : streams) {
stream.flush();
}
}
@Override
public void write(byte[] ba) throws IOException {
for (OutputStream stream : streams) {
stream.write(ba);
}
}
@Override
public void write(byte[] ba, int off, int len) throws IOException {
for (OutputStream stream : streams) {
stream.write(ba, off, len);
}
}
@Override
public void write(int b) throws IOException {
for (OutputStream stream : streams) {
stream.write(b);
}
}
}
|