diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-12-07 16:55:07 -0500 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-12-07 16:55:07 -0500 |
| commit | c765153fa6d6a204f5eee4c2e35efcc76c12be72 (patch) | |
| tree | 6bef97be21f1b767aa5c2702dd2418fbad313236 /src/main/java/bjc/everge/MirrorOutputStream.java | |
| parent | ffdeed6d39f651bc6ffb75ecf9b8134798041f82 (diff) | |
Setpoint after fixing an issue
Fixed an issue, after a while away
Get to a known state
Diffstat (limited to 'src/main/java/bjc/everge/MirrorOutputStream.java')
| -rw-r--r-- | src/main/java/bjc/everge/MirrorOutputStream.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/main/java/bjc/everge/MirrorOutputStream.java b/src/main/java/bjc/everge/MirrorOutputStream.java new file mode 100644 index 0000000..6718bd7 --- /dev/null +++ b/src/main/java/bjc/everge/MirrorOutputStream.java @@ -0,0 +1,46 @@ +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); + } + } + + public void close() throws IOException { + for (OutputStream stream : streams) { + stream.close(); + } + } + + public void flush() throws IOException { + for (OutputStream stream : streams) { + stream.flush(); + } + } + + public void write(byte[] ba) throws IOException { + for (OutputStream stream : streams) { + stream.write(ba); + } + } + + public void write(byte[] ba, int off, int len) throws IOException { + for (OutputStream stream : streams) { + stream.write(ba, off, len); + } + } + + public void write(int b) throws IOException { + for (OutputStream stream : streams) { + stream.write(b); + } + } +} |
