Java.util.zip.InflaterInputStream class in Java
This class implements a stream filter for uncompressing data in the “deflate” compression format. It is also used as the basis for other decompression filters, such as GZIPInputStream.
- InflaterInputStream(InputStream in) : Creates a new input stream with a default decompressor and buffer size.
- InflaterInputStream(InputStream in, Inflater inf) : Creates a new input stream with the specified decompressor and a default buffer size.
- InflaterInputStream(InputStream in, Inflater inf, int size) : Creates a new input stream with the specified decompressor and buffer size.
- int available() : Returns 0 after EOF has been reached, otherwise always return 1.
Syntax : public int available() throws IOException Returns: 1 before EOF and 0 after EOF. Throws: IOException
- void close() : Closes this input stream and releases any system resources associated with the stream.
Syntax : public void close() throws IOException Throws: IOException
- protected void fill() : Fills input buffer with more data to decompress.
Syntax : protected void fill() throws IOException Throws: IOException
- void mark(int readlimit) : Marks the current position in this input stream.
Syntax : public void mark(int readlimit) Parameters: readlimit - the maximum limit of bytes that can be read before the mark position becomes invalid.
- boolean markSupported() : Tests if this input stream supports the mark and reset methods.
Syntax : public boolean markSupported() Returns: a boolean indicating if this stream type supports the mark and reset methods.
- int read() : Reads a byte of uncompressed data.
Syntax : public int read() throws IOException Returns: the byte read, or -1 if end of compressed input is reached Throws: IOException
- int read(byte b, int off, int len) : Reads uncompressed data into an array of bytes.
Syntax : public int read(byte b, int off, int len) throws IOException Parameters: b - the buffer into which the data is read off - the start offset in the destination array b len - the maximum number of bytes read Returns: the actual number of bytes read, or -1 if the end of the compressed input is reached. Throws: NullPointerException IndexOutOfBoundsException ZipException IOException
- void reset() : Repositions this stream to the position at the time the mark method was last called on this input stream.
Syntax : public void reset() throws IOException Throws: IOException
- long skip(long n) : Skips specified number of bytes of uncompressed data.
Syntax : public long skip(long n) throws IOException Parameters: n - the number of bytes to skip Returns: the actual number of bytes skipped. Throws: IOException IllegalArgumentException
1 false 3456789
Next Article: Java.util.zip.InflaterOutputStream class in Java
This article is contributed by Nishant Sharma. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.