From c765153fa6d6a204f5eee4c2e35efcc76c12be72 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Sat, 7 Dec 2019 16:55:07 -0500 Subject: Setpoint after fixing an issue Fixed an issue, after a while away Get to a known state --- src/main/java/bjc/everge/MirrorOutputStream.java | 46 ++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/main/java/bjc/everge/MirrorOutputStream.java (limited to 'src/main/java/bjc/everge/MirrorOutputStream.java') 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 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); + } + } +} -- cgit v1.2.3