net.i2p.util
Class ResettableGZIPOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.util.zip.DeflaterOutputStream
              extended by net.i2p.util.ResettableGZIPOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable
Direct Known Subclasses:
ReusableGZIPOutputStream

public class ResettableGZIPOutputStream
extends java.util.zip.DeflaterOutputStream

GZIP implementation per RFC 1952, reusing java's standard CRC32 and Deflater implementations. The main difference is that this implementation allows its state to be reset to initial values, and hence reused, while the standard GZIPOutputStream writes the GZIP header to the stream on instantiation, rather than on first write.


Field Summary
 
Fields inherited from class java.util.zip.DeflaterOutputStream
buf, def
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
ResettableGZIPOutputStream(java.io.OutputStream o)
           
 
Method Summary
 void close()
           
 void finish()
           
 void reset()
          Reinitialze everything so we can write a brand new gzip output stream again.
 void write(byte[] buf)
           
 void write(byte[] buf, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.util.zip.DeflaterOutputStream
deflate
 
Methods inherited from class java.io.FilterOutputStream
flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResettableGZIPOutputStream

public ResettableGZIPOutputStream(java.io.OutputStream o)
Method Detail

reset

public void reset()
Reinitialze everything so we can write a brand new gzip output stream again.


close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.util.zip.DeflaterOutputStream
Throws:
java.io.IOException

finish

public void finish()
            throws java.io.IOException
Overrides:
finish in class java.util.zip.DeflaterOutputStream
Throws:
java.io.IOException

write

public void write(int b)
           throws java.io.IOException
Overrides:
write in class java.util.zip.DeflaterOutputStream
Throws:
java.io.IOException

write

public void write(byte[] buf)
           throws java.io.IOException
Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException

write

public void write(byte[] buf,
                  int off,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.util.zip.DeflaterOutputStream
Throws:
java.io.IOException