1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-16 06:15:02 -05:00
filebot/source/net/sourceforge/tuned/TeePrintStream.java

57 lines
892 B
Java
Raw Normal View History

package net.sourceforge.tuned;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
public class TeePrintStream extends PrintStream {
private final PrintStream cc;
public TeePrintStream(OutputStream out, boolean autoFlush, String encoding, PrintStream cc) throws UnsupportedEncodingException {
super(out, autoFlush, encoding);
this.cc = cc;
}
@Override
public void close() {
super.close();
cc.close();
}
@Override
public void flush() {
super.flush();
cc.flush();
}
@Override
public void write(byte[] buf, int off, int len) {
super.write(buf, off, len);
cc.write(buf, off, len);
}
@Override
public void write(int b) {
super.write(b);
cc.write(b);
}
@Override
public void write(byte[] b) throws IOException {
super.write(b);
cc.write(b);
}
}