Java EE 5 SDK

com.sun.appserv.web.cache.filter
Class CachingOutputStreamWrapper

java.lang.Object
  extended by java.io.OutputStream
      extended by javax.servlet.ServletOutputStream
          extended by com.sun.appserv.web.cache.filter.CachingOutputStreamWrapper
All Implemented Interfaces:
Closeable, Flushable

public class CachingOutputStreamWrapper
extends ServletOutputStream

an output stream wrapper to cache response bytes


Constructor Summary
CachingOutputStreamWrapper()
           
 
Method Summary
 void close()
          Close this output stream, causing any buffered data to be flushed and any further output data to throw an IOException.
 void flush()
          Flush any buffered data for this output stream, which also causes the response to be committed.
 byte[] getBytes()
          return the cached bytes
 void write(byte[] b)
          Write b.length bytes from the specified byte array to our output stream.
 void write(byte[] b, int off, int len)
          Write len bytes from the specified byte array, starting at the specified offset, to our output stream.
 void write(int b)
          Write the specified byte to our output stream.
 
Methods inherited from class javax.servlet.ServletOutputStream
print, print, print, print, print, print, print, println, println, println, println, println, println, println, println
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingOutputStreamWrapper

public CachingOutputStreamWrapper()
Method Detail

write

public void write(int b)
           throws IOException
Write the specified byte to our output stream.

Specified by:
write in class OutputStream
Parameters:
b - The byte to be written
Throws:
IOException - if an input/output error occurs

write

public void write(byte[] b)
           throws IOException
Write b.length bytes from the specified byte array to our output stream.

Overrides:
write in class OutputStream
Parameters:
b - The byte array to be written
Throws:
IOException - if an input/output error occurs

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Write len bytes from the specified byte array, starting at the specified offset, to our output stream.

Overrides:
write in class OutputStream
Parameters:
b - The byte array containing the bytes to be written
off - Zero-relative starting offset of the bytes to be written
len - The number of bytes to be written
Throws:
IOException - if an input/output error occurs

flush

public void flush()
           throws IOException
Flush any buffered data for this output stream, which also causes the response to be committed.

Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException

close

public void close()
           throws IOException
Close this output stream, causing any buffered data to be flushed and any further output data to throw an IOException.

Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException

getBytes

public byte[] getBytes()
return the cached bytes


Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.