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