public class InflaterOutputStream
extends FilterOutputStream
java.lang.Object | |||
↳ | java.io.OutputStream | ||
↳ | java.io.FilterOutputStream | ||
↳ | java.util.zip.InflaterOutputStream |
实现一个输出流过滤器,用于解压缩以“deflate”压缩格式存储的数据。
Fields |
|
---|---|
protected final byte[] |
buf 用于写入未压缩数据的输出缓冲区。 |
protected final Inflater |
inf 这个流的解压缩器。 |
Inherited fields |
---|
From class java.io.FilterOutputStream
|
Public constructors |
|
---|---|
InflaterOutputStream(OutputStream out) 用默认的解压缩器和缓冲区大小创建一个新的输出流。 |
|
InflaterOutputStream(OutputStream out, Inflater infl) 使用指定的解压缩器和默认缓冲区大小创建新的输出流。 |
|
InflaterOutputStream(OutputStream out, Inflater infl, int bufLen) 用指定的解压缩器和缓冲区大小创建一个新的输出流。 |
Public methods |
|
---|---|
void |
close() 将剩余的未压缩数据写入输出流并关闭底层输出流。 |
void |
finish() 完成将未压缩的数据写入输出流而不关闭底层流。 |
void |
flush() 刷新此输出流,强制写入任何未决的缓冲输出字节。 |
void |
write(byte[] b, int off, int len) 将一个字节数组写入未压缩的输出流。 |
void |
write(int b) 将一个字节写入未压缩的输出流。 |
Inherited methods |
|
---|---|
From class java.io.FilterOutputStream
|
|
From class java.io.OutputStream
|
|
From class java.lang.Object
|
|
From interface java.io.Closeable
|
|
From interface java.io.Flushable
|
|
From interface java.lang.AutoCloseable
|
InflaterOutputStream (OutputStream out)
用默认的解压缩器和缓冲区大小创建一个新的输出流。
Parameters | |
---|---|
out |
OutputStream : output stream to write the uncompressed data to |
Throws | |
---|---|
NullPointerException |
if out is null |
InflaterOutputStream (OutputStream out, Inflater infl)
使用指定的解压缩器和默认缓冲区大小创建新的输出流。
Parameters | |
---|---|
out |
OutputStream : output stream to write the uncompressed data to |
infl |
Inflater : decompressor ("inflater") for this stream |
Throws | |
---|---|
NullPointerException |
if out or infl is null |
InflaterOutputStream (OutputStream out, Inflater infl, int bufLen)
用指定的解压缩器和缓冲区大小创建一个新的输出流。
Parameters | |
---|---|
out |
OutputStream : output stream to write the uncompressed data to |
infl |
Inflater : decompressor ("inflater") for this stream |
bufLen |
int : decompression buffer size |
Throws | |
---|---|
IllegalArgumentException |
if bufLen is <= 0 |
NullPointerException |
if out or infl is null |
void close ()
将剩余的未压缩数据写入输出流并关闭底层输出流。
Throws | |
---|---|
IOException |
if an I/O error occurs |
void finish ()
完成将未压缩的数据写入输出流而不关闭底层流。 连续应用多个过滤器到相同的输出流时使用此方法。
Throws | |
---|---|
IOException |
if an I/O error occurs or this stream is already closed |
void flush ()
刷新此输出流,强制写入任何未决的缓冲输出字节。
Throws | |
---|---|
IOException |
if an I/O error occurs or this stream is already closed |
void write (byte[] b, int off, int len)
将一个字节数组写入未压缩的输出流。
Parameters | |
---|---|
b |
byte : buffer containing compressed data to decompress and write to the output stream |
off |
int : starting offset of the compressed data within b |
len |
int : number of bytes to decompress from b |
Throws | |
---|---|
IndexOutOfBoundsException |
if off < 0, or if len < 0, or if len > b.length - off |
IOException |
if an I/O error occurs or this stream is already closed |
NullPointerException |
if b is null |
ZipException |
if a compression (ZIP) format error occurs |
void write (int b)
将一个字节写入未压缩的输出流。
Parameters | |
---|---|
b |
int : a single byte of compressed data to decompress and write to the output stream |
Throws | |
---|---|
IOException |
if an I/O error occurs or this stream is already closed |
ZipException |
if a compression (ZIP) format error occurs |