1 18 19 package org.apache.tools.ant.util; 20 21 import java.io.OutputStream ; 22 import java.io.IOException ; 23 24 28 public class TeeOutputStream extends OutputStream { 29 private OutputStream left; 30 private OutputStream right; 31 32 37 public TeeOutputStream(OutputStream left, OutputStream right) { 38 this.left = left; 39 this.right = right; 40 } 41 42 46 public void close() throws IOException { 47 try { 48 left.close(); 49 } finally { 50 right.close(); 51 } 52 } 53 54 58 public void flush() throws IOException { 59 left.flush(); 60 right.flush(); 61 } 62 63 68 public void write(byte[] b) throws IOException { 69 left.write(b); 70 right.write(b); 71 } 72 73 80 public void write(byte[] b, int off, int len) throws IOException { 81 left.write(b, off, len); 82 right.write(b, off, len); 83 } 84 85 90 public void write(int b) throws IOException { 91 left.write(b); 92 right.write(b); 93 } 94 } 95 96 | Popular Tags |