1 23 24 package com.sun.appserv.web.cache.filter; 25 26 import java.io.IOException ; 27 import java.io.ByteArrayOutputStream ; 28 29 import javax.servlet.ServletOutputStream ; 30 31 34 public class CachingOutputStreamWrapper extends ServletOutputStream { 35 36 ByteArrayOutputStream baos; 37 38 public CachingOutputStreamWrapper() { 39 this.baos = new ByteArrayOutputStream (4096); 40 } 41 42 49 public void write(int b) throws IOException { 50 baos.write(b); 51 } 52 53 61 public void write(byte b[]) throws IOException { 62 baos.write(b, 0, b.length); 63 } 64 65 75 public void write(byte b[], int off, int len) throws IOException { 76 baos.write(b, off, len); 77 } 78 79 83 public void flush() throws IOException { 84 } 86 87 91 public void close() throws IOException { 92 } 94 95 98 public byte[] getBytes() { 99 return baos.toByteArray(); 100 } 101 } 102 | Popular Tags |