java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
java.util.zip.DeflaterInputStream
public class DeflaterInputStream
为使用 "deflate" 压缩格式压缩数据实现输入流过滤器。
DeflaterOutputStream,
InflaterOutputStream,
InflaterInputStream
| 字段摘要 | |
|---|---|
protected byte[] |
buf 读取压缩数据的输入缓冲区。 |
protected Deflater |
def 此流的压缩器。 |
| 从类 java.io.FilterInputStream 继承的字段 |
|---|
in |
| 构造方法摘要 | |
|---|---|
DeflaterInputStream(InputStream in) 创建一个带有默认压缩器和缓冲区大小的新输入流。 |
|
DeflaterInputStream(InputStream in, Deflater defl) 创建一个带有指定压缩器和默认缓冲区大小的新输入流。 |
|
DeflaterInputStream(InputStream in, Deflater defl, int bufLen) 创建一个带有指定压缩器和缓冲区大小的新输入流。 |
|
| 方法摘要 | |
|---|---|
int |
available() 在到达 EOF 后返回 0;否则始终返回 1。 |
void |
close() 关闭此输入流和它的底层输入流,丢弃挂起的未压缩数据。 |
void |
mark(int limit) 不支持此操作。 |
boolean |
markSupported() 始终返回 false,因为此输入流不支持 mark() 和 reset() 方法。 |
int |
read() 从输入流读取一个压缩数据的单个字节。 |
int |
read(byte[] b, int off, int len) 将压缩数据读入 byte 数组。 |
void |
reset() 不支持此操作。 |
long |
skip(long n) 从输入流中跳过并丢弃数据。 |
| 从类 java.io.FilterInputStream 继承的方法 |
|---|
read |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
protected final Deflater def
protected final byte[] buf
| 构造方法详细信息 |
|---|
public DeflaterInputStream(InputStream in)
in - 要读入未压缩数据的输入流
NullPointerException - 如果
in 为 null
public DeflaterInputStream(InputStream in, Deflater defl)
in - 要读入未压缩数据的输入流
defl - 此流的压缩器 ("deflater")
NullPointerException - 如果
in 或
defl 为 null
public DeflaterInputStream(InputStream in, Deflater defl, int bufLen)
in - 要读入未压缩数据的输入流
defl - 此流的压缩器 ("deflater")
bufLen - 压缩缓冲区大小
IllegalArgumentException - 如果
bufLen <= 0
NullPointerException - 如果
in 或
defl 为 null
| 方法详细信息 |
|---|
public void close()
throws IOException
Closeable 中的
close
FilterInputStream 中的
close
IOException - 如果发生 I/O 错误
FilterInputStream.in
public int read()
throws IOException
FilterInputStream 中的
read
IOException - 如果发生 I/O 错误或如果此流已经关闭
FilterInputStream.in
public int read(byte[] b,
int off,
int len)
throws IOException
FilterInputStream 中的
read
b - 要读入数据的缓冲区
off -
b 中数据的起始偏移量
len - 要读入
b 的最大压缩字节数
IndexOutOfBoundsException - 如果
len >
b.length - off
IOException - 如果发生 I/O 错误或者此输入流已经关闭
FilterInputStream.in
public long skip(long n)
throws IOException
n 作为
long 给出时,可以跳过的最大字节数为
Integer.MAX_VALUE。
FilterInputStream 中的
skip
n - 要跳过的字节数
IOException - 如果发生 I/O 错误或者此流已经关闭
public int available()
throws IOException
程序不应依靠此方法返回可以不受阻塞地读取的实际字节数。
FilterInputStream 中的
available
IOException - 如果发生 I/O 错误或者此流已经关闭
public boolean markSupported()
false,因为此输入流不支持
mark() 和
reset() 方法。
FilterInputStream 中的
markSupported
FilterInputStream.in,
InputStream.mark(int),
InputStream.reset()
public void mark(int limit)
FilterInputStream 中的
mark
limit - 在位置标记无效前可以读取的最大字节数
FilterInputStream.in,
FilterInputStream.reset()
public void reset()
throws IOException
FilterInputStream 中的
reset
IOException - 始终抛出
FilterInputStream.in,
FilterInputStream.mark(int)