java.util.zip
类 ZipEntry
java.lang.Objectjava.util.zip.ZipEntry
- 所有已实现的接口:
- Cloneable
- 直接已知子类:
- JarEntry
public class ZipEntryextends Objectimplements Cloneable
此类用于表示 ZIP 文件条目。
| 字段摘要 | |
|---|---|
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 | DEFLATED用于已压缩 (deflated) 条目的压缩方法。 |
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 |
static int | STORED用于未压缩条目的压缩方法。 |
| 构造方法摘要 | |
|---|---|
ZipEntry(String name)使用指定名称创建新的 ZIP 条目。 | |
ZipEntry(ZipEntry e)使用从指定 ZIP 条目获取的字段创建新的 ZIP 条目。 | |
| 方法摘要 | |
|---|---|
Object | clone()返回此条目的副本。 |
String | getComment()返回条目的注释字符串;如果没有,则返回 null。 |
long | getCompressedSize()返回压缩条目数据的大小;如果未知,则返回 -1。 |
long | getCrc()返回未压缩条目数据的 CRC-32 校验和;如果未知,则返回 -1。 |
byte[] | getExtra()返回条目的额外字段数据;如果没有,则返回 null。 |
int | getMethod()返回条目的压缩方法;如果未指定,则返回 -1。 |
String | getName()返回条目名称。 |
long | getSize()返回条目数据的未压缩大小;如果未知,则返回 -1。 |
long | getTime()返回条目的修改时间;如果未指定,则返回 -1。 |
int | hashCode()返回此条目的哈希码值。 |
boolean | isDirectory()如果为目录条目,则返回 true。 |
void | setComment(String comment)为条目设置可选的注释字符串。 |
void | setCompressedSize(long csize)设置压缩条目数据的大小。 |
void | setCrc(long crc)设置未压缩条目数据的 CRC-32 校验和。 |
void | setExtra(byte[] extra)为条目设置可选的额外字段数据。 |
void | setMethod(int method)设置条目的压缩方法。 |
void | setSize(long size)设置条目数据的未压缩大小。 |
void | setTime(long time)设置条目的修改时间。 |
String | toString()返回 ZIP 条目的字符串表示形式。 |
| 从类 java.lang.Object 继承的方法 |
|---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
| 字段详细信息 |
|---|
STORED
public static final int STORED
- 用于未压缩条目的压缩方法。
- 另请参见:
- 常量字段值
DEFLATED
public static final int DEFLATED
- 用于已压缩 (deflated) 条目的压缩方法。
- 另请参见:
- 常量字段值
LOCSIG
public static final long LOCSIG
- 常量字段值
- 另请参见:
EXTSIG
public static final long EXTSIG
- 常量字段值
- 另请参见:
CENSIG
public static final long CENSIG
- 常量字段值
- 另请参见:
ENDSIG
public static final long ENDSIG
- 常量字段值
- 另请参见:
LOCHDR
public static final int LOCHDR
- 常量字段值
- 另请参见:
EXTHDR
public static final int EXTHDR
- 常量字段值
- 另请参见:
CENHDR
public static final int CENHDR
- 常量字段值
- 另请参见:
ENDHDR
public static final int ENDHDR
- 常量字段值
- 另请参见:
LOCVER
public static final int LOCVER
- 常量字段值
- 另请参见:
LOCFLG
public static final int LOCFLG
- 常量字段值
- 另请参见:
LOCHOW
public static final int LOCHOW
- 常量字段值
- 另请参见:
LOCTIM
public static final int LOCTIM
- 常量字段值
- 另请参见:
LOCCRC
public static final int LOCCRC
- 常量字段值
- 另请参见:
LOCSIZ
public static final int LOCSIZ
- 常量字段值
- 另请参见:
LOCLEN
public static final int LOCLEN
- 常量字段值
- 另请参见:
LOCNAM
public static final int LOCNAM
- 常量字段值
- 另请参见:
LOCEXT
public static final int LOCEXT
- 常量字段值
- 另请参见:
EXTCRC
public static final int EXTCRC
- 常量字段值
- 另请参见:
EXTSIZ
public static final int EXTSIZ
- 常量字段值
- 另请参见:
EXTLEN
public static final int EXTLEN
- 常量字段值
- 另请参见:
CENVEM
public static final int CENVEM
- 常量字段值
- 另请参见:
CENVER
public static final int CENVER
- 常量字段值
- 另请参见:
CENFLG
public static final int CENFLG
- 常量字段值
- 另请参见:
CENHOW
public static final int CENHOW
- 常量字段值
- 另请参见:
CENTIM
public static final int CENTIM
- 常量字段值
- 另请参见:
CENCRC
public static final int CENCRC
- 常量字段值
- 另请参见:
CENSIZ
public static final int CENSIZ
- 常量字段值
- 另请参见:
CENLEN
public static final int CENLEN
- 常量字段值
- 另请参见:
CENNAM
public static final int CENNAM
- 常量字段值
- 另请参见:
CENEXT
public static final int CENEXT
- 常量字段值
- 另请参见:
CENCOM
public static final int CENCOM
- 常量字段值
- 另请参见:
CENDSK
public static final int CENDSK
- 常量字段值
- 另请参见:
CENATT
public static final int CENATT
- 常量字段值
- 另请参见:
CENATX
public static final int CENATX
- 常量字段值
- 另请参见:
CENOFF
public static final int CENOFF
- 常量字段值
- 另请参见:
ENDSUB
public static final int ENDSUB
- 常量字段值
- 另请参见:
ENDTOT
public static final int ENDTOT
- 常量字段值
- 另请参见:
ENDSIZ
public static final int ENDSIZ
- 常量字段值
- 另请参见:
ENDOFF
public static final int ENDOFF
- 常量字段值
- 另请参见:
ENDCOM
public static final int ENDCOM
- 常量字段值
- 另请参见:
| 构造方法详细信息 |
|---|
ZipEntry
public ZipEntry(String name)
- 使用指定名称创建新的 ZIP 条目。
- 参数:
name- 条目名称 抛出:NullPointerException- 如果条目名称为 nullIllegalArgumentException- 如果条目名称大于 0xFFFF 字节
ZipEntry
public ZipEntry(ZipEntry e)
- 使用从指定 ZIP 条目获取的字段创建新的 ZIP 条目。
- 参数:
e- ZIP Entry 对象
| 方法详细信息 |
|---|
getName
public String getName()
- 返回条目名称。
-
- 返回:
- 条目名称
setTime
public void setTime(long time)
- 设置条目的修改时间。
-
- 参数:
time- 自从出现以来以毫秒数表示的条目修改时间 另请参见:- getTime()
getTime
public long getTime()
- 返回条目的修改时间;如果未指定,则返回 -1。
-
- 返回:
- 条目的修改时间;如果未指定,则返回 -1 另请参见:
- setTime(long)
setSize
public void setSize(long size)
- 设置条目数据的未压缩大小。
-
- 参数:
size- 以字节表示的未压缩大小 抛出:IllegalArgumentException- 如果指定大小小于 0 或大于 0xFFFFFFFF 字节 另请参见:- getSize()
getSize
public long getSize()
- 返回条目数据的未压缩大小;如果未知,则返回 -1。
-
- 返回:
- 条目数据的未压缩大小;如果未知,则返回 -1 另请参见:
- setSize(long)
getCompressedSize
public long getCompressedSize()
- 返回压缩条目数据的大小;如果未知,则返回 -1。对于 stored 条目,其压缩大小与该条目的未压缩大小相同。
-
- 返回:
- 压缩条目数据的大小;如果未知,则返回 -1 另请参见:
- setCompressedSize(long)
setCompressedSize
public void setCompressedSize(long csize)
- 设置压缩条目数据的大小。
-
- 参数:
csize- 要设置的压缩大小 另请参见:- getCompressedSize()
setCrc
public void setCrc(long crc)
- 设置未压缩条目数据的 CRC-32 校验和。
-
- 参数:
crc- CRC-32 值 抛出:IllegalArgumentException- 如果指定的 CRC-32 值小于 0 或大于 0xFFFFFFFF 另请参见:- getCrc()
getCrc
public long getCrc()
- 返回未压缩条目数据的 CRC-32 校验和;如果未知,则返回 -1。
-
- 返回:
- 未压缩条目数据的 CRC-32 校验和;如果未知,则返回 -1 另请参见:
- setCrc(long)
setMethod
public void setMethod(int method)
- 设置条目的压缩方法。
-
- 参数:
method- 压缩方法,可以为 STORED 或 DEFLATED 抛出:IllegalArgumentException- 如果指定压缩方法无效 另请参见:- getMethod()
getMethod
public int getMethod()
- 返回条目的压缩方法;如果未指定,则返回 -1。
-
- 返回:
- 条目的压缩方法;如果未指定,则返回 -1 另请参见:
- setMethod(int)
setExtra
public void setExtra(byte[] extra)
- 为条目设置可选的额外字段数据。
-
- 参数:
extra- 额外字段数据字节 抛出:IllegalArgumentException- 如果指定的额外字段数据的长度大于 0xFFFF 字节 另请参见:- getExtra()
getExtra
public byte[] getExtra()
- 返回条目的额外字段数据;如果没有,则返回 null。
-
- 返回:
- 条目的额外字段数据;如果没有,则返回 null 另请参见:
- setExtra(byte[])
setComment
public void setComment(String comment)
- 为条目设置可选的注释字符串。
-
- 参数:
comment- 注释字符串 抛出:IllegalArgumentException- 如果指定的注释字符串的长度大于 0xFFFF 字节 另请参见:- getComment()
getComment
public String getComment()
- 返回条目的注释字符串;如果没有,则返回 null。
-
- 返回:
- 条目的注释字符串;如果没有,则返回 null 另请参见:
- setComment(String)
isDirectory
public boolean isDirectory()
- 如果为目录条目,则返回 true。目录条目定义为其名称以 '/' 结尾的条目。
-
- 返回:
- 如果为目录条目,则返回 true
toString
public String toString()
- 返回 ZIP 条目的字符串表示形式。
-
- 覆盖:
- 类
Object中的toString
- 类
-
- 返回:
- 该对象的字符串表示形式。
hashCode
public int hashCode()
- 返回此条目的哈希码值。
-
- 覆盖:
- 类
Object中的hashCode
- 类
-
- 返回:
- 此对象的一个哈希码值。 另请参见:
- Object.equals(java.lang.Object), Hashtable
clone
public Object clone()
- 返回此条目的副本。
-
- 覆盖:
- 类
Object中的clone
- 类
-
- 返回:
- 此实例的一个副本。 另请参见:
- Cloneable
本文详细介绍Java中ZipEntry类的功能及用法,包括字段说明、构造方法及常用方法介绍,适用于需要处理ZIP文件的开发者。
java.util.zip.ZipEntry
519

被折叠的 条评论
为什么被折叠?



