public class ZipInputStream extends InflaterInputStream
Modifier and Type | Field and Description |
---|---|
static int |
CENATT |
static int |
CENATX |
static int |
CENCOM |
static int |
CENCRC |
static int |
CENDSK |
static int |
CENEXT |
static int |
CENFLG |
static int |
CENHDR |
static int |
CENHOW |
static int |
CENLEN |
static int |
CENNAM |
static int |
CENOFF |
static long |
CENSIG |
static int |
CENSIZ |
static int |
CENTIM |
static int |
CENVEM |
static int |
CENVER |
static int |
ENDCOM |
static int |
ENDHDR |
static int |
ENDOFF |
static long |
ENDSIG |
static int |
ENDSIZ |
static int |
ENDSUB |
static int |
ENDTOT |
static int |
EXTCRC |
static int |
EXTHDR |
static int |
EXTLEN |
static long |
EXTSIG |
static int |
EXTSIZ |
static int |
LOCCRC |
static int |
LOCEXT |
static int |
LOCFLG |
static int |
LOCHDR |
static int |
LOCHOW |
static int |
LOCLEN |
static int |
LOCNAM |
static long |
LOCSIG |
static int |
LOCSIZ |
static int |
LOCTIM |
static int |
LOCVER |
buf, inf, len
in
Constructor and Description |
---|
ZipInputStream(InputStream in)
创建一个新的ZIP输入流。
|
ZipInputStream(InputStream in, Charset charset)
创建一个新的ZIP输入流。
|
Modifier and Type | Method and Description |
---|---|
int |
available()
EOF到达当前条目数据后返回0,否则返回1。
|
void |
close()
关闭此输入流并释放与流相关联的任何系统资源。
|
void |
closeEntry()
关闭当前的ZIP条目,并定位流以读取下一个条目。
|
protected ZipEntry |
createZipEntry(String name)
为指定的条目名称创建一个新的
ZipEntry 对象。
|
ZipEntry |
getNextEntry()
读取下一个ZIP文件条目,并将流定位在条目数据的开头。
|
int |
read(byte[] b, int off, int len)
从当前ZIP条目读取到字节数组。
|
long |
skip(long n)
跳过当前ZIP条目中指定的字节数。
|
fill, mark, markSupported, read, reset
read
public static final long LOCSIG
public static final long EXTSIG
public static final long CENSIG
public static final long ENDSIG
public static final int LOCHDR
public static final int EXTHDR
public static final int CENHDR
public static final int ENDHDR
public static final int LOCVER
public static final int LOCFLG
public static final int LOCHOW
public static final int LOCTIM
public static final int LOCCRC
public static final int LOCSIZ
public static final int LOCLEN
public static final int LOCNAM
public static final int LOCEXT
public static final int EXTCRC
public static final int EXTSIZ
public static final int EXTLEN
public static final int CENVEM
public static final int CENVER
public static final int CENFLG
public static final int CENHOW
public static final int CENTIM
public static final int CENCRC
public static final int CENSIZ
public static final int CENLEN
public static final int CENNAM
public static final int CENEXT
public static final int CENCOM
public static final int CENDSK
public static final int CENATT
public static final int CENATX
public static final int CENOFF
public static final int ENDSUB
public static final int ENDTOT
public static final int ENDSIZ
public static final int ENDOFF
public static final int ENDCOM
public ZipInputStream(InputStream in)
UTF-8 charset
用于解码条目名称。
in
- 实际的输入流
public ZipInputStream(InputStream in, Charset charset)
in
- 实际的输入流
charset
-该charset要使用到ZIP条目名称(忽略,如果解码language encoding bit ZIP条目的通用位标志的设置)。
public ZipEntry getNextEntry() throws IOException
ZipException
- 如果发生ZIP文件错误
IOException
- 如果发生I / O错误
public void closeEntry() throws IOException
ZipException
- 如果发生ZIP文件错误
IOException
- 如果发生I / O错误
public int available() throws IOException
程序不应该依赖此方法来返回可以读取而不阻止的实际字节数。
available
在
InflaterInputStream
IOException
- 如果发生I / O错误。
public int read(byte[] b, int off, int len) throws IOException
len
不为零,则该方法将阻塞,直到某些输入可用;
否则,不会读取字节,并返回0
。
read
在
InflaterInputStream
b
- 读取数据的缓冲区
off
- 目的地阵列中的起始偏移量
b
len
- 读取的最大字节数
NullPointerException
- 如果
b
是
null
。
IndexOutOfBoundsException
- 如果
off
为负数,则
len
为负数,或
len
大于
b.length - off
ZipException
- 如果发生ZIP文件错误
IOException
- 如果发生I / O错误
FilterInputStream.in
public long skip(long n) throws IOException
skip
在
InflaterInputStream
n
- 要跳过的字节数
ZipException
- 如果发生ZIP文件错误
IOException
- 如果发生I / O错误
IllegalArgumentException
- 如果
n < 0
public void close() throws IOException
close
在界面
Closeable
close
在界面
AutoCloseable
close
在类别
InflaterInputStream
IOException
- 如果发生I / O错误
FilterInputStream.in
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.