1 package hudson.util; 2 3 import java.io.IOException ; 4 import java.io.OutputStream ; 5 6 9 public class DualOutputStream extends OutputStream { 10 private final OutputStream lhs,rhs; 11 12 public DualOutputStream(OutputStream lhs, OutputStream rhs) { 13 this.lhs = lhs; 14 this.rhs = rhs; 15 } 16 17 public void write(int b) throws IOException { 18 lhs.write(b); 19 rhs.write(b); 20 } 21 22 public void write(byte[] b) throws IOException { 23 lhs.write(b); 24 rhs.write(b); 25 } 26 27 public void write(byte[] b, int off, int len) throws IOException { 28 lhs.write(b,off,len); 29 rhs.write(b,off,len); 30 } 31 32 public void flush() throws IOException { 33 lhs.flush(); 34 rhs.flush(); 35 } 36 37 public void close() throws IOException { 38 lhs.close(); 39 rhs.close(); 40 } 41 } 42 | Popular Tags |