net.i2p.util

## Class ResettableGZIPOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - java.io.FilterOutputStream
    - - java.util.zip.DeflaterOutputStream
      - - net.i2p.util.ResettableGZIPOutputStream

- All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable
  Direct Known Subclasses:
    ReusableGZIPOutputStream

      public class ResettableGZIPOutputStream
      extends 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

    Constructors
    Constructor and Description
    `ResettableGZIPOutputStream(OutputStream o)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `void` | `destroy()` Calls super.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, flush`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ResettableGZIPOutputStream

          public ResettableGZIPOutputStream(OutputStream o)

  - ### Method Detail

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Overrides:
        `close` in class `DeflaterOutputStream`
      Throws:
        `IOException`

    - #### destroy

          public void destroy()
                       throws IOException

      Calls super.close(). May not be reused after this.
      Throws:
        `IOException`

    - #### finish

          public void finish()
                      throws IOException

      Overrides:
        `finish` in class `DeflaterOutputStream`
      Throws:
        `IOException`

    - #### reset

          public void reset()

      Reinitialze everything so we can write a brand new gzip output stream again.

    - #### write

          public void write(byte[] buf)
                     throws IOException

      Overrides:
        `write` in class `FilterOutputStream`
      Throws:
        `IOException`

    - #### write

          public void write(byte[] buf,
                            int off,
                            int len)
                     throws IOException

      Overrides:
        `write` in class `DeflaterOutputStream`
      Throws:
        `IOException`

    - #### write

          public void write(int b)
                     throws IOException

      Overrides:
        `write` in class `DeflaterOutputStream`
      Throws:
        `IOException`