1 package servletunit; 2 3 19 import javax.servlet.ServletOutputStream ; 20 import java.io.IOException ; 21 import java.io.OutputStream ; 22 23 public class ServletOutputStreamSimulator extends ServletOutputStream 24 { 25 private OutputStream outStream; 26 27 30 public ServletOutputStreamSimulator() 31 { 32 this.outStream = System.out; 33 } 34 35 39 public ServletOutputStreamSimulator( OutputStream out ) 40 { 41 this.outStream = out; 42 } 43 44 public void write( int b ) 45 { 46 try 47 { 48 outStream.write( b ); 49 } 50 catch( IOException io ) 51 { 52 System.err.println("IOException: " + io.getMessage()); 53 io.printStackTrace(); 54 } 55 } 56 } 57 | Popular Tags |