所有类
java.util.zip
类 GZIPInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
java.util.zip.InflaterInputStream
java.util.zip.GZIPInputStream
- 所有已实现的接口:
- Closeable
public class GZIPInputStream
- extends InflaterInputStream
此类为读取 GZIP 文件格式的压缩数据实现流过滤器。
- 另请参见:
InflaterInputStream
方法摘要 |
---|
void | close() 关闭此输入流并释放与该流关联的所有系统资源。 |
int | read(byte[] buf, int off, int len) 将未压缩数据读入字节数组。 |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
crc
protected CRC32 crc
- 未压缩数据的 CRC-32。
eos
protected boolean eos
- 指示输入流的结尾。
GZIP_MAGIC
public static final int GZIP_MAGIC
- GZIP 头幻数。
- 另请参见:
- 常量字段值
GZIPInputStream
public GZIPInputStream(InputStream in,
int size)
throws IOException
- 使用指定缓冲区大小创建新的输入流。
- 参数:
in
- 输入流 size
- 输入缓冲区大小 - 抛出:
IOException
- 如果发生 I/O 错误 IllegalArgumentException
- 如果大小为 <= 0
GZIPInputStream
public GZIPInputStream(InputStream in)
throws IOException
- 使用默认缓冲区大小创建新的输入流。
- 参数:
in
- 输入流 - 抛出:
IOException
- 如果发生 I/O 错误
read
public int read(byte[] buf,
int off,
int len)
throws IOException
- 将未压缩数据读入字节数组。在足够的输入可用于解压缩之前将处于阻塞状态。
- 覆盖:
- 类
InflaterInputStream
中的 read
- 参数:
buf
- 要读入数据的缓冲区 off
- 数据的初始偏移量 len
- 读取字节的最大数 - 返回:
- 实际读取的字节数;如果已到达压缩输入流的结尾,则返回 -1
- 抛出:
IOException
- 如果发生 I/O 错误或压缩输入数据损坏 - 另请参见:
FilterInputStream.in
close
public void close()
throws IOException
- 关闭此输入流并释放与该流关联的所有系统资源。
- 指定者:
- 接口
Closeable
中的 close
- 覆盖:
- 类
InflaterInputStream
中的 close
- 抛出:
IOException
- 如果发生 I/O 错误 - 另请参见:
FilterInputStream.in
所有类