public class InflaterInputStream 
   extends FilterInputStream 
| java.lang.Object | |||
| ↳ | java.io.InputStream | ||
| ↳ | java.io.FilterInputStream | ||
| ↳ | java.util.zip.InflaterInputStream | ||
|  Known Direct Subclasses | 
|  Known Indirect Subclasses | 
这个类实现了一个流过滤器,用于以“deflate”压缩格式解压缩数据。 它也被用作其他解压过滤器的基础,比如GZIPInputStream。
也可以看看:
| Fields | |
|---|---|
|  protected byte[] | buf输入缓冲区用于解压缩。 | 
|  protected boolean | closed | 
|  protected Inflater | inf这个流的解压缩器。 | 
|  protected int | len输入缓冲区的长度。 | 
| Inherited fields | 
|---|
|  From class  java.io.FilterInputStream  | 
| Public constructors | |
|---|---|
|  InflaterInputStream(InputStream in, Inflater inf, int size) 用指定的解压缩器和缓冲区大小创建一个新的输入流。 | |
|  InflaterInputStream(InputStream in, Inflater inf) 用指定的解压缩器和默认缓冲区大小创建一个新的输入流。 | |
|  InflaterInputStream(InputStream in) 用默认的解压缩器和缓冲区大小创建一个新的输入流。 | |
| Public methods | |
|---|---|
|  int |  available() EOF达到后返回0,否则返回1。 | 
|  void |  close() 关闭此输入流并释放与该流关联的所有系统资源。 | 
|  void |  mark(int readlimit) 标记此输入流中的当前位置。 | 
|  boolean |  markSupported() 测试此输入流是否支持  | 
|  int |  read() 读取一个未压缩的数据字节。 | 
|  int |  read(byte[] b, int off, int len) 将未压缩的数据读入一个字节数组。 | 
|  void |  reset() 将此流重新定位到上次在此输入流上调用  | 
|  long |  skip(long n) 跳过未压缩数据的指定字节数。 | 
| Protected methods | |
|---|---|
|  void |  fill() 用更多数据填充输入缓冲区以解压缩。 | 
| Inherited methods | |
|---|---|
|  From class  java.io.FilterInputStream  | |
|  From class  java.io.InputStream  | |
|  From class  java.lang.Object  | |
|  From interface  java.io.Closeable  | |
|  From interface  java.lang.AutoCloseable  | |
InflaterInputStream (InputStream in, Inflater inf, int size)
用指定的解压缩器和缓冲区大小创建一个新的输入流。
| Parameters | |
|---|---|
| in | InputStream: the input stream | 
| inf | Inflater: the decompressor ("inflater") | 
| size | int: the input buffer size | 
| Throws | |
|---|---|
| IllegalArgumentException | if size is <= 0 | 
InflaterInputStream (InputStream in, Inflater inf)
用指定的解压缩器和默认缓冲区大小创建一个新的输入流。
| Parameters | |
|---|---|
| in | InputStream: the input stream | 
| inf | Inflater: the decompressor ("inflater") | 
InflaterInputStream (InputStream in)
用默认的解压缩器和缓冲区大小创建一个新的输入流。
| Parameters | |
|---|---|
| in | InputStream: the input stream | 
int available ()
EOF达到后返回0,否则返回1。
程序不应该依赖此方法来返回可以不受阻塞地读取的实际字节数。
| Returns | |
|---|---|
| int | 1 before EOF and 0 after EOF. | 
| Throws | |
|---|---|
| IOException | if an I/O error occurs. | 
void close ()
关闭此输入流并释放与该流关联的所有系统资源。
| Throws | |
|---|---|
| IOException | if an I/O error has occurred | 
void mark (int readlimit)
标记此输入流中的当前位置。
mark方法 InflaterInputStream什么都不做。
| Parameters | |
|---|---|
| readlimit | int: the maximum limit of bytes that can be read before the mark position becomes invalid. | 
也可以看看:
boolean markSupported ()
测试此输入流是否支持mark和reset方法。 该markSupported方法InflaterInputStream回报false 。
| Returns | |
|---|---|
| boolean | a booleanindicating if this stream type supports themarkandresetmethods. | 
int read ()
读取一个未压缩的数据字节。 此方法将阻塞,直到有足够的输入可用于解压缩。
| Returns | |
|---|---|
| int | the byte read, or -1 if end of compressed input is reached | 
| Throws | |
|---|---|
| IOException | if an I/O error has occurred | 
int read (byte[] b, 
                int off, 
                int len) 
     将未压缩的数据读入一个字节数组。 如果len不为零,该方法将阻塞,直到某些输入可以解压缩为止; 否则,不读取字节并返回0 。
| Parameters | |
|---|---|
| b | byte: the buffer into which the data is read | 
| off | int: the start offset in the destination arrayb | 
| len | int: the maximum number of bytes read | 
| Returns | |
|---|---|
| int | the actual number of bytes read, or -1 if the end of the compressed input is reached or a preset dictionary is needed | 
| Throws | |
|---|---|
| NullPointerException | If bisnull. | 
| IndexOutOfBoundsException | If offis negative,lenis negative, orlenis greater thanb.length - off | 
| ZipException | if a ZIP format error has occurred | 
| IOException | if an I/O error has occurred | 
void reset ()
将此流重新定位到上次在此输入流上调用 mark方法时的位置。
类 InflaterInputStream的方法 reset除了抛出 IOException之外什么都不 IOException 。
| Throws | |
|---|---|
| IOException | if this method is invoked. | 
也可以看看:
long skip (long n)
跳过未压缩数据的指定字节数。
| Parameters | |
|---|---|
| n | long: the number of bytes to skip | 
| Returns | |
|---|---|
| long | the actual number of bytes skipped. | 
| Throws | |
|---|---|
| IOException | if an I/O error has occurred | 
| IllegalArgumentException | if n < 0 | 
void fill ()
用更多数据填充输入缓冲区以解压缩。
| Throws | |
|---|---|
| IOException | if an I/O error has occurred |