public class GZIPInputStream extends InflaterInputStream
InflaterInputStream
| Modifier and Type | Field and Description |
|---|---|
protected CRC32 |
crc
CRC-32未压缩的数据。
|
protected boolean |
eos
指示输入流的结束。
|
static int |
GZIP_MAGIC
gzip头神奇的数字。
|
buf, inf, lenin| Constructor and Description |
|---|
GZIPInputStream(InputStream in)
用默认缓冲区大小创建一个新的输入流。
|
GZIPInputStream(InputStream in, int size)
用指定的缓冲区大小创建一个新的输入流。
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
关闭此输入流并释放与流关联的任何系统资源。
|
int |
read(byte[] buf, int off, int len)
读取压缩数据到字节数组。
|
available, fill, mark, markSupported, read, reset, skipreadprotected CRC32 crc
protected boolean eos
public static final int GZIP_MAGIC
public GZIPInputStream(InputStream in, int size) throws IOException
in -输入流
size -输入缓冲区的大小
ZipException如果GZIP格式发生错误或使用的压缩方法是不支持的
IOException如果发生I/O错误
size <= 0
IllegalArgumentException
public GZIPInputStream(InputStream in) throws IOException
in -输入流
ZipException如果GZIP格式发生错误或使用的压缩方法是不支持的
IOException如果发生I/O错误
public int read(byte[] buf,
int off,
int len)
throws IOException
len不为零,该方法将阻塞直到某些输入可以解压缩;否则,没有字节读取和
0返回。
read 方法重写,继承类
InflaterInputStream
buf -缓冲区中读取数据
off -开始抵消目标数组
b
len -的最大字节数读
null
buf
NullPointerException。
IndexOutOfBoundsException -如果
off是负的,
len是负的,或
len大于
buf.length - off
ZipException如果压缩输入数据损坏。
IOException如果发生I/O错误。
FilterInputStream.in
public void close()
throws IOException
close 接口
Closeable
close 接口
AutoCloseable
close 方法重写,继承类
InflaterInputStream
IOException如果发生I/O错误
FilterInputStream.in
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.