javawebparts.filter
Class CompressionResStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--javax.servlet.ServletOutputStream
              |
              +--javawebparts.filter.CompressionResStream

public class CompressionResStream
extends javax.servlet.ServletOutputStream

This class is used to do compression.

Author:
Frank W. Zammetti.

Field Summary
private  java.io.ByteArrayOutputStream ba
          ByteArrayOutputStream ba.
private  java.lang.String compressionType
          What type of compression we are doing.
private  java.util.zip.DeflaterOutputStream ops
          Our output stream.
private  javax.servlet.ServletOutputStream out
          ServletOutputStream out.
private  javax.servlet.http.HttpServletResponse resp
          Reference to the response being serviced.
 
Fields inherited from class javax.servlet.ServletOutputStream
 
Constructor Summary
CompressionResStream(javax.servlet.http.HttpServletResponse inResponse, java.lang.String ct)
          Constructor.
 
Method Summary
 void close()
          Clean up.
 void flush()
          Flush the output stream.
 void write(byte[] bytes)
          Writes a byte array to the output stream.
 void write(byte[] bytes, int o, int leng)
          Writes a byte array to the output stream.
 void write(int b)
          Writes a single byte to the 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

ba

private java.io.ByteArrayOutputStream ba
ByteArrayOutputStream ba.


ops

private java.util.zip.DeflaterOutputStream ops
Our output stream. Will either be a GZipOutputStream (subclass of DeflaterOutputStream) or an actual DeflaterOutputStream, depending on what type of compression it is configured to do.


resp

private javax.servlet.http.HttpServletResponse resp
Reference to the response being serviced.


out

private javax.servlet.ServletOutputStream out
ServletOutputStream out.


compressionType

private java.lang.String compressionType
What type of compression we are doing.

Constructor Detail

CompressionResStream

public CompressionResStream(javax.servlet.http.HttpServletResponse inResponse,
                            java.lang.String ct)
                     throws java.io.IOException
Constructor.

Parameters:
inResponse - The HTTPServletResponse being services.
ct - What type of compression to perform.
Throws:
java.io.IOException - IOException.
Method Detail

write

public void write(int b)
           throws java.io.IOException
Writes a single byte to the output stream.

Specified by:
write in class java.io.OutputStream
Parameters:
b - A single byte to write.
Throws:
java.io.IOException - IOException.

close

public void close()
           throws java.io.IOException
Clean up.

Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException - IOException.

write

public void write(byte[] bytes)
           throws java.io.IOException
Writes a byte array to the output stream.

Overrides:
write in class java.io.OutputStream
Parameters:
bytes - Byte array.
Throws:
java.io.IOException - IOException.

write

public void write(byte[] bytes,
                  int o,
                  int leng)
           throws java.io.IOException
Writes a byte array to the output stream.

Overrides:
write in class java.io.OutputStream
Parameters:
bytes - Byte array.
o - o.
leng - Length.
Throws:
java.io.IOException - IOEXception.

flush

public void flush()
           throws java.io.IOException
Flush the output stream.

Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException - IOException.


Copyright 2005 Frank W. Zammetti