|
Chapter 18 The java.util.zip Package |
|
InflaterInputStream
Name
InflaterInputStream
- Class Name:
-
java.util.zip.InflaterInputStream
- Superclass:
-
java.io.FilterInputStream
- Immediate Subclasses:
-
java.util.zip.GZIPInputStream,
java.util.zip.ZipInputStream
- Interfaces Implemented:
-
None
- Availability:
-
New as of JDK 1.1
The InflaterInputStream class
represents an InputStream with
an associated Inflater. In
other words, an InflaterInputStream
wraps a regular input stream, so that data read from the stream is read
from an underlying stream and decompressed. Two subclasses, GZIPInputStream
and ZipInputStream, read compressed
data in widely recognized formats.
public class java.util.zip.InflaterInputStream
extends java.io.FilterInputStream {
// Variables
protected byte[] buf;
protected Inflater inf;
protected int len;
// Constructors
public InflaterInputStream(InputStream in);
public InflaterInputStream(InputStream in, Inflater inf);
public InflaterInputStream(InputStream in, Inflater inf, int size);
// Public Instance Methods
public int read();
public int read(byte[] b, int off, int len);
public long skip(long n);
// Protected Instance Methods
protected void fill();
}
- Description
-
A buffer that holds the compressed data that is written to the underlying
stream.
- Description
-
The Inflater that is used internally.
- Description
-
The amount of data that is in the input buffer.
- Parameters
-
- in
-
The underlying input stream.
- Description
-
This constructor creates an InflaterInputStream
that reads data from the given InputStream.
Before being read, the data is decompressed by a default Inflater.
The InflaterInputStream uses
a decompression buffer with the default size of 512 bytes.
- Parameters
-
- in
-
The underlying input stream.
- inf
-
The Inflater object.
- Description
-
This constructor creates an InflaterInputStream
that reads data from the given InputStream.
Before being read, the data is decompressed by the given Inflater.
The InflaterInputStream uses
a decompression buffer with the default size of 512 bytes.
- Parameters
-
- in
-
The underlying input stream.
- inf
-
The Inflater object.
- size
-
The size of the input buffer.
- Description
-
This constructor creates an InflaterInputStream
that reads data from the given InputStream.
Before being read, the data is decompressed by the given Inflater.
The InflaterInputStream uses
a decompression buffer of the given size.
- Returns
-
The next uncompressed byte or -1 if the end of the stream is encountered.
- Throws
-
- IOException
-
If any kind of I/O error occurs.
- Overrides
-
FilterInputStream.read()
- Description
-
This method reads enough data from the underlying InputStream
to return a byte of uncompressed data. The method blocks until enough data
is available for decompression, the end of the stream is detected, or an
exception is thrown.
- Parameters
-
- b
-
An array of bytes to be filled from the stream.
- off
-
An offset into the byte array.
- len
-
The number of bytes to read.
- Returns
-
The number of bytes read or -1 if the end of the stream is encountered
immediately.
- Throws
-
- IOException
-
If any kind of I/O error occurs.
- Overrides
-
FilterInputStream.read(byte[], int, int)
- Description
-
This method reads enough data from the underlying InputStream
to return len bytes of uncompressed
data. The uncompressed data is placed into the given array starting at
off. The method blocks until
some data is available for decompression.
- Returns
-
The actual number of bytes skipped.
- Throws
-
- IOException
-
If any kind of I/O error occurs.
- Overrides
-
FilterInputStream.skip()
- Description
-
This method skips over the specified number of uncompressed data bytes
by reading data from the underlying InputStream
and decompressing it.
- Throws
-
- IOException
-
If any kind of I/O error occurs.
- Description
-
This method fills the input buffer with compressed data from the underlying
InputStream.
FilterInputStream,
GZIPInputStream,
Inflater,
InputStream,
IOException,
ZipInputStream
|
|