1 18 package filters.gzip; 19 20 import java.io.ByteArrayOutputStream ; 21 import java.io.IOException ; 22 23 import javax.servlet.ServletOutputStream ; 24 25 31 public class ByteArrayServletOutputStream extends ServletOutputStream { 32 33 private ByteArrayOutputStream bodyStream; 34 35 public ByteArrayServletOutputStream() { 36 this.bodyStream = new ByteArrayOutputStream (); 37 } 38 39 public byte[] getContent() { 40 return this.bodyStream.toByteArray(); 41 } 42 43 public void write(int b) throws IOException { 44 this.bodyStream.write(b); 45 } 46 47 public void flush() throws IOException { 48 this.bodyStream.flush(); 49 } 50 } 51 | Popular Tags |