Class DeflaterInputStream

All Implemented Interfaces:
Closeable, AutoCloseable

public class DeflaterInputStream extends FilterInputStream
Implements an input stream filter for compressing data in the "deflate" compression format.

Compressor Usage

A DeflaterInputStream created without specifying a compressor will create a compressor at construction time, and close the compressor when the input stream is closed.

If a compressor is specified when creating a DeflaterInputStream, it is the responsibility of the caller to close the compressor after closing the input stream.

Since:
1.6
See Also:
  • Field Details

    • def

      protected final Deflater def
      Compressor for this stream.
    • buf

      protected final byte[] buf
      Input buffer for reading compressed data.
  • Constructor Details

    • DeflaterInputStream

      public DeflaterInputStream(InputStream in)
      Creates a new input stream and compressor with the default compression level and a default buffer size.

      The compressor will be closed when this input stream is closed.

      Parameters:
      in - input stream to read the uncompressed data to
      Throws:
      NullPointerException - if in is null
    • DeflaterInputStream

      public DeflaterInputStream(InputStream in, Deflater defl)
      Creates a new input stream with the specified compressor and a default buffer size.

      Closing this input stream will not close the given compressor.

      Parameters:
      in - input stream to read the uncompressed data to
      defl - compressor ("deflater") for this stream
      Throws:
      NullPointerException - if in or defl is null
    • DeflaterInputStream

      public DeflaterInputStream(InputStream in, Deflater defl, int bufLen)
      Creates a new input stream with the specified compressor and buffer size.

      Closing this input stream will not close the given compressor.

      Parameters:
      in - input stream to read the uncompressed data to
      defl - compressor ("deflater") for this stream
      bufLen - compression buffer size
      Throws:
      IllegalArgumentException - if bufLen <= 0
      NullPointerException - if in or defl is null
  • Method Details