All Implemented Interfaces:
Closeable, AutoCloseable

public class DeflaterInputStream
extends FilterInputStream

Implements an input stream filter for compressing data in the "deflate" compression format.

Since:
1.6
See Also:
DeflaterOutputStream, InflaterOutputStream, InflaterInputStream
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected byte[] buf

    Input buffer for reading compressed data.

    protected Deflater def

    Compressor for this stream.

  • Constructor Summary

    Constructors 
    Constructor Description
    DeflaterInputStream​(InputStream in)

    Creates a new input stream with a default compressor and buffer size.

    DeflaterInputStream​(InputStream in, Deflater defl)

    Creates a new input stream with the specified compressor and a default buffer size.

    DeflaterInputStream​(InputStream in, Deflater defl, int bufLen)

    Creates a new input stream with the specified compressor and buffer size.

  • Method Summary

    Modifier and Type Method Description
    int available()

    Returns 0 after EOF has been reached, otherwise always return 1.

    void close()

    Closes this input stream and its underlying input stream, discarding any pending uncompressed data.

    void mark​(int limit)

    This operation is not supported.

    boolean markSupported()

    Always returns false because this input stream does not support the mark() and reset() methods.

    int read()

    Reads a single byte of compressed data from the input stream.

    int read​(byte[] b, int off, int len)

    Reads compressed data into a byte array.

    void reset()

    This operation is not supported.

    long skip​(long n)

    Skips over and discards data from the input stream.

    Methods declared in class java.lang.Object

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

  • Field Details

    • def

      Compressor for this stream.

    • buf

      protected final byte[] buf

      Input buffer for reading compressed data.

  • Constructor Details

    • DeflaterInputStream

      Creates a new input stream with a default compressor and buffer size.

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

      Creates a new input stream with the specified compressor and a default buffer size.

      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

      Creates a new input stream with the specified compressor and buffer size.

      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