com.limegroup.gnutella.util
Class CompressingOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended byjava.util.zip.DeflaterOutputStream
              extended bycom.limegroup.gnutella.util.CompressingOutputStream

public final class CompressingOutputStream
extends java.util.zip.DeflaterOutputStream

Simulates zlib's Z_PARTIAL_FLUSH and Z_SYNC_FLUSH behaviour. This is a workaround for the following bugParade bugs:
http://developer.java.sun.com/developer/bugParade/bugs/4255743.html
http://developer.java.sun.com/developer/bugParade/bugs/4206909.html
The code was taken from the comments at those respective pages and modified slightly.


Field Summary
 
Fields inherited from class java.util.zip.DeflaterOutputStream
buf, def
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
CompressingOutputStream(java.io.OutputStream out, java.util.zip.Deflater flate)
           
 
Method Summary
protected  void deflate()
           
 void flush()
          Insure all remaining data will be output.
 
Methods inherited from class java.util.zip.DeflaterOutputStream
close, finish, write, write
 
Methods inherited from class java.io.FilterOutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompressingOutputStream

public CompressingOutputStream(java.io.OutputStream out,
                               java.util.zip.Deflater flate)
Method Detail

flush

public void flush()
           throws java.io.IOException
Insure all remaining data will be output.

Throws:
java.io.IOException

deflate

protected void deflate()
                throws java.io.IOException
Throws:
java.io.IOException