package net.swisstech.swissarmyknife.io;

import java.io.IOException;
import java.io.OutputStream;

/** yes, commons-io has something like this too but I don't want to pull in an entire jar for a single class */
class TeeOutputStream extends OutputStream {

	private final OutputStream streamA;
	private final OutputStream streamB;

	public TeeOutputStream(OutputStream streamA, OutputStream streamB) {
		this.streamA = streamA;
		this.streamB = streamB;
	}

	@Override
	public void write(int b) throws IOException {
		streamA.write(b);
		streamB.write(b);
	}

	@Override
	public void write(byte[] b) throws IOException {
		streamA.write(b);
		streamB.write(b);
	}

	@Override
	public void write(byte[] b, int off, int len) throws IOException {
		streamA.write(b, off, len);
		streamB.write(b, off, len);
	}

	@Override
	public void flush() throws IOException {
		streamA.flush();
		streamB.flush();
	}

	@Override
	public void close() throws IOException {
		streamA.close();
		streamB.close();
	}
}

@@ -96,16 +96,19 @@
 am;%0A%0A/**
+%0A *
  yes, co
@@ -204,16 +204,33 @@
 le class
+%0A * @since 1.1.5%0A
  */%0Aclas

add @since tag now that we've resurrected it