org.talika.tarsis.filters.gzip
Class GZIPServletOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by javax.servlet.ServletOutputStream
          extended by org.talika.tarsis.filters.gzip.GZIPServletOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public final class GZIPServletOutputStream
extends javax.servlet.ServletOutputStream

ServletOutputStream wrapper that allows us to compress response.

Version:
$Revision: 122 $
Author:
Jose M. Palomar

Constructor Summary
GZIPServletOutputStream(javax.servlet.ServletOutputStream out)
          Creates an output stream adaptor wrapping the given output stream.
GZIPServletOutputStream(javax.servlet.ServletOutputStream out, int size)
          Creates an output stream adaptor wrapping the given output stream and buffer size.
 
Method Summary
 void close()
          Closes this output stream and releases any system resources associated with this stream.
 void flush()
          Flushes this output stream and forces any buffered output bytes to be written out.
 void write(byte[] data, int off, int len)
          Writes len bytes from the specified byte array starting at offset off to this output stream.
 void write(int data)
          Writes the specified byte to this 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.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GZIPServletOutputStream

public GZIPServletOutputStream(javax.servlet.ServletOutputStream out)
                        throws java.io.IOException
Creates an output stream adaptor wrapping the given output stream.

Parameters:
out - ServletOutputStream output stream to be wrapped.
Throws:
java.io.IOException - if an input or output exception occurs.

GZIPServletOutputStream

public GZIPServletOutputStream(javax.servlet.ServletOutputStream out,
                               int size)
                        throws java.io.IOException
Creates an output stream adaptor wrapping the given output stream and buffer size.

Parameters:
out - ServletOutputStream output stream to be wrapped.
size - int buffer size.
Throws:
java.io.IOException - if an input or output exception occurs.
Method Detail

write

public void write(byte[] data,
                  int off,
                  int len)
           throws java.io.IOException
Writes len bytes from the specified byte array starting at offset off to this output stream.

Overrides:
write in class java.io.OutputStream
Parameters:
data - byte[] the data.
off - int the start offset in the data.
len - int the number of bytes to write.
Throws:
java.io.IOException - if an input or output exception occurs.

write

public void write(int data)
           throws java.io.IOException
Writes the specified byte to this output stream.

Specified by:
write in class java.io.OutputStream
Parameters:
data - int the byte.
Throws:
java.io.IOException - if an input or output exception occurs.

close

public void close()
           throws java.io.IOException
Closes this output stream and releases any system resources associated with this stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException - if an input or output exception occurs.

flush

public void flush()
           throws java.io.IOException
Flushes this output stream and forces any buffered output bytes to be written out.

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException - if an input or output exception occurs.


Copyright © 2002-2012 Talika Open Source Group. All Rights Reserved.