DeflaterInputStream 

Introduction

The java.util.zip.DeflaterInputStream class implements an input stream filter for compressing data in the “deflate” compression format.

Class Declaration

Following is the declaration for java.util.zip.DeflaterInputStream class −

publicclassDeflaterInputStreamextendsFilterInputStream

Learn Java in-depth with real-world projects through our Java certification course. Enroll and become a certified expert to boost your career.

Fields

Following are the fields for java.util.zip.DeflaterInputStream class −

  • protected byte[] buf − Input buffer for reading compressed data.
  • protected Deflater def − Compressor for this stream.

Constructors

Sr.No.Constructor & Description
1DeflaterInputStream(InputStream in)Creates a new input stream with a default compressor and buffer size.
2DeflaterInputStream(InputStream in, Deflater defl)Creates a new input stream with the specified compressor and a default buffer size.
3DeflaterInputStream(InputStream in, Deflater defl, int bufLen)Creates a new input stream with the specified compressor and buffer size.

Class Methods

Sr.No.Method & Description
1int available()Returns 0 after EOF has been reached, otherwise always return 1.
2void close()Closes this input stream and its underlying input stream, discarding any pending uncompressed data.
3int read()Reads a single byte of compressed data from the input stream.
4int read(byte[] b, int off, int len)Reads compressed data into a byte array.
5long skip(long n)Skips over and discards data from the input stream.

Methods Inherited

This class inherits methods from the following classes −

  • java.io.FilterInputStream
  • java.lang.Object

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *