1 18 package org.objectweb.util.monolog.wrapper.common; 19 20 import java.io.OutputStream ; 21 import java.io.IOException ; 22 23 30 public class OutputStreamSwitcher extends OutputStream { 31 32 protected OutputStream currentOut; 33 34 public OutputStreamSwitcher() { 35 currentOut = System.out; 36 } 37 38 public OutputStreamSwitcher(OutputStream defaultOut) { 39 this.currentOut = defaultOut; 40 } 41 42 public void switchOutput(OutputStream newOut) { 43 currentOut = newOut; 44 } 45 46 public void write(byte b[]) throws IOException { 47 currentOut.write(b); 48 } 49 50 public void write(byte b[], int off, int len) throws IOException { 51 currentOut.write(b, off, len); 52 } 53 54 public void write(int b) throws IOException { 55 currentOut.write(b); 56 } 57 58 public void flush() throws IOException { 59 currentOut.flush(); 60 } 61 62 public void close() throws IOException { 63 } 64 } 65 | Popular Tags |