1 15 package org.apache.tapestry.util.io; 16 17 import java.io.IOException ; 18 import java.io.OutputStream ; 19 20 import org.apache.hivemind.util.Defense; 21 22 28 public class TeeOutputStream extends OutputStream 29 { 30 private final OutputStream _os1; 31 32 private final OutputStream _os2; 33 34 public TeeOutputStream(OutputStream os1, OutputStream os2) 35 { 36 Defense.notNull(os1, "os1"); 37 Defense.notNull(os2, "os2"); 38 39 _os1 = os1; 40 _os2 = os2; 41 } 42 43 public void close() throws IOException 44 { 45 _os1.close(); 46 _os2.close(); 47 } 48 49 public void flush() throws IOException 50 { 51 _os1.flush(); 52 _os2.flush(); 53 } 54 55 public void write(byte[] b, int off, int len) throws IOException 56 { 57 _os1.write(b, off, len); 58 _os2.write(b, off, len); 59 } 60 61 public void write(byte[] b) throws IOException 62 { 63 _os1.write(b); 64 _os1.write(b); 65 } 66 67 public void write(int b) throws IOException 68 { 69 _os1.write(b); 70 _os2.write(b); 71 } 72 } | Popular Tags |