net.i2p.util

## Class ReusableGZIPOutputStream

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

- All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

      public class ReusableGZIPOutputStream
      extends ResettableGZIPOutputStream

  Provide a cache of reusable GZIP streams, each handling up to 40 KB output without expansion. This compresses to memory only. Retrieve the compressed data with getData(). There is no facility to compress to an output stream. Do NOT use this for compression of unlimited-size data, as it will expand, but never release, the BAOS memory buffer.

- - ### Field Summary

    - ### Fields inherited from class java.util.zip.DeflaterOutputStream

      `buf, def`

    - ### Fields inherited from class java.io.FilterOutputStream

      `out`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ReusableGZIPOutputStream` | `acquire()` Pull a cached instance
    `static void` | `clearCache()` Clear the cache.
    `byte[]` | `getData()` pull the contents of the stream written
    `static void` | `release(ReusableGZIPOutputStream out)` Release an instance back into the cache (this will discard any state)
    `void` | `reset()` clear the data so we can start again afresh
    `void` | `setLevel(int level)`

    - ### Methods inherited from class net.i2p.util.ResettableGZIPOutputStream

      `close, destroy, finish, write, write, write`

    - ### 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`

- - ### Method Detail

    - #### acquire

          public static ReusableGZIPOutputStream acquire()

      Pull a cached instance

    - #### clearCache

          public static void clearCache()

      Clear the cache.

    - #### getData

          public byte[] getData()

      pull the contents of the stream written

    - #### release

          public static void release(ReusableGZIPOutputStream out)

      Release an instance back into the cache (this will discard any state)

    - #### reset

          public void reset()

      clear the data so we can start again afresh
      Overrides:
        `reset` in class `ResettableGZIPOutputStream`

    - #### setLevel

          public void setLevel(int level)