public class JarInputStream extends ZipInputStream
JarInputStream
类用于从输入流读取任何JAR文件的内容。它延伸阅读一个可选的
Manifest
进入支持类
java.util.zip.ZipInputStream
。的
Manifest
可以用来存储JAR文件及其项的元信息。
Manifest
,
ZipInputStream
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 |
---|
JarInputStream(InputStream in)
创建一个新的
JarInputStream 读取可选清单。
|
JarInputStream(InputStream in, boolean verify)
创建一个新的
JarInputStream 读取可选清单。
|
Modifier and Type | Method and Description |
---|---|
protected ZipEntry |
createZipEntry(String name)
创建一个新的
JarEntry (
ZipEntry )为指定的jar文件条目名称。
|
Manifest |
getManifest()
返回此JAR文件的
Manifest ,或
null 如果没有。
|
ZipEntry |
getNextEntry()
读取下一个压缩文件条目,并在输入数据的开头处的流中的位置。
|
JarEntry |
getNextJarEntry()
读取下一个“下一个”“文件”项,并在输入数据的开头处定位流。
|
int |
read(byte[] b, int off, int len)
从当前的“文件”输入到一个字节数组中读取。
|
available, close, closeEntry, skip
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 JarInputStream(InputStream in) throws IOException
JarInputStream
读取可选清单。如果一个明显的存在,也试图验证签名,如果jarinputstream签署。
in
-实际输入流
IOException
如果发生I/O错误
public JarInputStream(InputStream in, boolean verify) throws IOException
JarInputStream
读取可选清单。如果清单是目前验证是正确的,还试图验证签名,如果jarinputstream签署。
in
-实际输入流
verify
是否验证jarinputstream是否签署。
IOException
如果发生I/O错误
public Manifest getManifest()
Manifest
,或
null
如果没有。
Manifest
,或
null
如果没有。
public ZipEntry getNextEntry() throws IOException
getNextEntry
方法重写,继承类
ZipInputStream
ZipException
如果发生ZIP文件错误
IOException
如果发生I/O错误
SecurityException
-如果任何JAR文件条目签署不正确。
public JarEntry getNextJarEntry() throws IOException
ZipException
如果发生ZIP文件错误
IOException
如果发生I/O错误
SecurityException
-如果任何JAR文件条目签署不正确。
public int read(byte[] b, int off, int len) throws IOException
len
不为零,该方法阻塞直到输入可用;否则,没有字节读取和
0
返回。如果已启用验证,则在进入之前的当前条目上的任何无效签名将在到达结束之前的某个点上报告。
read
方法重写,继承类
ZipInputStream
b
-缓冲区中读取数据
off
-开始抵消目标数组
b
len
-的最大字节数读
null
b
NullPointerException
。
IndexOutOfBoundsException
-如果
off
是负的,
len
是负的,或
len
大于
b.length - off
ZipException
如果发生ZIP文件错误
IOException
如果发生I/O错误
SecurityException
-如果任何JAR文件条目签署不正确。
FilterInputStream.in
protected ZipEntry createZipEntry(String name)
JarEntry
(
ZipEntry
)为指定的jar文件条目名称。指定的jar文件条目名称的清单属性将被复制到新
JarEntry
。
createZipEntry
方法重写,继承类
ZipInputStream
name
-罐/ ZIP文件项的名称
JarEntry
对象
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.