static OutputStream teeOutputStream(final OutputStream a, final OutputStream b) { if (a == null) ret b; if (b == null) ret a; ret new OutputStream { public void write(int byt) throws IOException { a.write(byt); b.write(byt); } public void write(byte[] byt, int off, int len) throws IOException { a.write(byt, off, len); b.write(byt, off, len); } }; }