| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
javax.servlet.ServletOutputStream
net.sf.click.extras.filter.CompressionResponseStream
Provides an implementation of ServletOutputStream that works with the CompressionServletResponseWrapper implementation.
Note this Jakarta Tomcat examples Filter is packaged in Click Extras for convenience.
| Field Summary | |
| protected  byte[] | bufferThe buffer through which all of our output bytes are passed. | 
| protected  int | bufferCountThe number of data bytes currently in the buffer. | 
| protected  boolean | closedHas this stream been closed? | 
| protected  int | compressionThresholdThe threshold number which decides to compress or not. | 
| protected  GZIPOutputStream | gzipstreamThe underlying gzip output stream to which we should write data. | 
| protected  int | lengthThe content length past which we will not write, or -1 if there is no defined content length. | 
| protected  ServletOutputStream | outputThe underlying servket output stream to which we should write data. | 
| protected  HttpServletResponse | responseThe response with which this servlet output stream is associated. | 
| Constructor Summary | |
| CompressionResponseStream(HttpServletResponse response)Construct a servlet output stream associated with the specified Response. | |
| Method Summary | |
|  void | close()Close this output stream, causing any buffered data to be flushed and any further output data to throw an IOException. | 
|  boolean | closed()Has this response stream been closed? | 
|  void | flush()Flush any buffered data for this output stream, which also causes the response to be committed. | 
|  void | flushToGZip()Flush the buffer to the gzip stream. | 
| protected  void | setBuffer(int threshold)Set the compressionThreshold number and create buffer for this size. | 
|  void | write(byte[] b)Write b.lengthbytes from the specified byte array
 to our output stream. | 
|  void | write(byte[] b,
      int off,
      int len)Write lenbytes 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. | 
|  void | writeToGZip(byte[] b,
            int off,
            int len)Writes array of bytes to the compressed 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 | 
| Field Detail | 
protected int compressionThreshold
protected byte[] buffer
protected int bufferCount
protected GZIPOutputStream gzipstream
protected boolean closed
protected int length
protected HttpServletResponse response
protected ServletOutputStream output
| Constructor Detail | 
public CompressionResponseStream(HttpServletResponse response)
                          throws IOException
response - The associated response
IOException - if an IO error occurs reading the response stream| Method Detail | 
protected void setBuffer(int threshold)
threshold - the compression threshold in bytes
public void close()
           throws IOException
IOException - if an error occurs closing the response
public void flush()
           throws IOException
IOException - if an error occurs flushing the gzip stream
public void flushToGZip()
                 throws IOException
IOException - if an error occurs flushing the buffer
public void write(int b)
           throws IOException
b - The byte to be written
IOException - if an input/output error occurs
public void write(byte[] b)
           throws IOException
b.length bytes from the specified byte array
 to our output stream.
b - The byte array to be written
IOException - if an input/output error occurs
public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
len bytes from the specified byte array, starting
 at the specified offset, to our output stream.
b - The byte array containing the bytes to be writtenoff - Zero-relative starting offset of the bytes to be writtenlen - The number of bytes to be written
IOException - if an input/output error occurs
public void writeToGZip(byte[] b,
                        int off,
                        int len)
                 throws IOException
b - the data to be writtenoff - the start offset of the datalen - the length of the data
IOException - If an I/O error has occurred.public boolean closed()
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||