com.opensymphony.oscache.web.filter
Class SplitServletOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjavax.servlet.ServletOutputStream
          extended bycom.opensymphony.oscache.web.filter.SplitServletOutputStream

public class SplitServletOutputStream
extends javax.servlet.ServletOutputStream

Extends the base ServletOutputStream class so that the stream can be captured as it gets written. This is achieved by overriding the write() methods and outputting the data to two streams - the original stream and a secondary stream that is designed to capture the written data.

Version:
$Revision: 1.1 $
Author:
Serge Knystautas

Constructor Summary
SplitServletOutputStream(OutputStream captureStream, OutputStream passThroughStream)
          Constructs a split output stream that both captures and passes through the servlet response.
 
Method Summary
 void write(byte[] value)
          Writes the incoming data to both the output streams.
 void write(byte[] b, int off, int len)
          Writes the incoming data to both the output streams.
 void write(int value)
          Writes the incoming data to both the output streams.
 
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.io.OutputStream
close, flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SplitServletOutputStream

public SplitServletOutputStream(OutputStream captureStream,
                                OutputStream passThroughStream)
Constructs a split output stream that both captures and passes through the servlet response.

Parameters:
captureStream - The stream that will be used to capture the data.
passThroughStream - The pass-through ServletOutputStream that will write the response to the client as originally intended.
Method Detail

write

public void write(int value)
           throws IOException
Writes the incoming data to both the output streams.

Parameters:
value - The int data to write.
Throws:
IOException

write

public void write(byte[] value)
           throws IOException
Writes the incoming data to both the output streams.

Parameters:
value - The bytes to write to the streams.
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Writes the incoming data to both the output streams.

Parameters:
b - The bytes to write out to the streams.
off - The offset into the byte data where writing should begin.
len - The number of bytes to write.
Throws:
IOException

OSCache Project Page