- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- java.util.zip.InflaterInputStream
-
- java.util.zip.GZIPInputStream
-
- 实现的所有接口
-
Closeable,AutoCloseable
public class GZIPInputStream extends InflaterInputStream
此类实现了一个流过滤器,用于读取GZIP文件格式的压缩数据。- 从以下版本开始:
- 1.1
- 另请参见:
-
InflaterInputStream
-
-
字段汇总
字段 变量和类型 字段 描述 protected CRC32crcCRC-32用于未压缩数据。protected booleaneos表示输入流的结束。static intGZIP_MAGICGZIP标头幻数。-
声明的属性在类 java.util.zip.InflaterInputStream
buf, inf, len
-
声明的属性在类 java.io.FilterInputStream
in
-
-
构造方法摘要
构造方法 构造器 描述 GZIPInputStream(InputStream in)使用默认缓冲区大小创建新的输入流。GZIPInputStream(InputStream in, int size)创建具有指定缓冲区大小的新输入流。
-
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 voidclose()关闭此输入流并释放与该流关联的所有系统资源。intread(byte[] buf, int off, int len)将未压缩的数据读入字节数组。-
声明方法的类 java.util.zip.InflaterInputStream
available, fill, mark, markSupported, read, reset, skip
-
声明方法的类 java.io.FilterInputStream
read
-
声明方法的类 java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
构造方法详细信息
-
GZIPInputStream
public GZIPInputStream(InputStream in, int size) throws IOException
创建具有指定缓冲区大小的新输入流。- 参数
-
in- 输入流 -
size- 输入缓冲区大小 - 异常
-
ZipException- 如果发生GZIP格式错误或不支持使用的压缩方法 -
IOException- 如果发生I / O错误 -
IllegalArgumentException- 如果size <= 0
-
GZIPInputStream
public GZIPInputStream(InputStream in) throws IOException
使用默认缓冲区大小创建新的输入流。- 参数
-
in- 输入流 - 异常
-
ZipException- 如果发生GZIP格式错误或不支持使用的压缩方法 -
IOException- 如果发生I / O错误
-
-
方法详细信息
-
read
public int read(byte[] buf, int off, int len) throws IOException将未压缩的数据读入字节数组。 如果len不为零,则该方法将阻塞,直到某些输入可以解压缩; 否则,不读取任何字节,返回0。- 重写:
-
read在InflaterInputStream类 - 参数
-
buf- 读取数据的缓冲区 -
off- 目标阵列b的起始偏移量 -
len- 读取的最大字节数 - 结果
- 读取的实际字节数,如果到达压缩输入流的末尾,则返回-1
- 异常
-
NullPointerException- 如果buf是null。 -
IndexOutOfBoundsException- 如果off为负数,则len为负数,或len为大于buf.length - off -
ZipException- 如果压缩的输入数据已损坏。 -
IOException- 如果发生I / O错误。 - 另请参见:
-
FilterInputStream.in
-
close
public void close() throws IOException关闭此输入流并释放与该流关联的所有系统资源。- Specified by:
-
close,界面AutoCloseable - Specified by:
-
close接口Closeable - 重写:
-
close在InflaterInputStream类 - 异常
-
IOException- 如果发生I / O错误 - 另请参见:
-
FilterInputStream.in
-
-