类 ZipEntry
java.lang.Object
java.util.zip.ZipEntry
com.sh.common.zip.ZipEntry
- 所有已实现的接口:
Cloneable
Extension that adds better handling of extra fields and provides
access to the internal and external file attributes.
The extra data is expected to follow the recommendation of the .ZIP File Format Specification created by PKWARE Inc. :
- the extra byte array consists of a sequence of extra fields
- each extra fields starts by a two byte header id followed by a two byte sequence holding the length of the remainder of data.
Any extra data that cannot be parsed by the rules above will be consumed as "unparseable" extra data and treated differently by the methods of this class. Versions prior to Apache Commons Compress 1.1 would have thrown an exception if any attempt was made to read or write extra data not conforming to the recommendation.
-
字段概要
字段修饰符和类型字段说明static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final longstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final longstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final longstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final longstatic final intstatic final intstatic final intstatic final intstatic final int -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidAdds an extra field - replacing an already present extra field of the same type.voidAdds an extra field - replacing an already present extra field of the same type.clone()Overwrite clone.booleanThe equality method.byte[]Retrieves the extra data for the central directory.longRetrieves the external file attributes.getExtraField(ZipShort type) Looks up an extra field by its header id.Retrieves all extra fields that have been parsed successfully.getExtraFields(boolean includeUnparseable) Retrieves extra fields.intRetrieves the internal file attributes.byte[]Retrieves the extra data for the local file data.getName()Get the name of the entry.intPlatform specification to put into the "version made by" part of the central file header.intUnix permission.Looks up extra field data that couldn't be parsed correctly.inthashCode()Get the hashCode of the entry.booleanIs this entry a directory?voidremoveExtraField(ZipShort type) Remove an extra field.voidRemoves unparseable extra field data.voidsetCentralDirectoryExtra(byte[] b) Sets the central directory part of extra fields.voidsetComprSize(long size) Make this class work in JDK 1.1 like a 1.2 class.voidsetExternalAttributes(long value) Sets the external file attributes.protected voidsetExtra()Unfortunatelyjava.util.zip.ZipOutputStreamseems to access the extra data directly, so overriding getExtra doesn't help - we need to modify super's data directly.voidsetExtra(byte[] extra) Parses the given bytes as extra field data and consumes any unparseable data as anUnparseableExtraFieldDatainstance.voidsetExtraFields(ZipExtraField[] fields) Replaces all currently attached extra fields with the new array.voidsetInternalAttributes(int value) Sets the internal file attributes.protected voidSet the name of the entry.protected voidsetPlatform(int platform) Set the platform (UNIX or FAT).voidsetUnixMode(int mode) Sets Unix permissions in a way that is understood by Info-Zip's unzip command.从类继承的方法 java.util.zip.ZipEntry
getComment, getCompressedSize, getCrc, getCreationTime, getExtra, getLastAccessTime, getLastModifiedTime, getMethod, getSize, getTime, getTimeLocal, setComment, setCompressedSize, setCrc, setCreationTime, setLastAccessTime, setLastModifiedTime, setMethod, setSize, setTime, setTimeLocal, toString
-
字段详细资料
-
PLATFORM_UNIX
public static final int PLATFORM_UNIX- 另请参阅:
-
PLATFORM_FAT
public static final int PLATFORM_FAT- 另请参阅:
-
LOCSIG
static final long LOCSIG- 另请参阅:
-
EXTSIG
static final long EXTSIG- 另请参阅:
-
CENSIG
static final long CENSIG- 另请参阅:
-
ENDSIG
static final long ENDSIG- 另请参阅:
-
LOCHDR
static final int LOCHDR- 另请参阅:
-
EXTHDR
static final int EXTHDR- 另请参阅:
-
CENHDR
static final int CENHDR- 另请参阅:
-
ENDHDR
static final int ENDHDR- 另请参阅:
-
LOCVER
static final int LOCVER- 另请参阅:
-
LOCFLG
static final int LOCFLG- 另请参阅:
-
LOCHOW
static final int LOCHOW- 另请参阅:
-
LOCTIM
static final int LOCTIM- 另请参阅:
-
LOCCRC
static final int LOCCRC- 另请参阅:
-
LOCSIZ
static final int LOCSIZ- 另请参阅:
-
LOCLEN
static final int LOCLEN- 另请参阅:
-
LOCNAM
static final int LOCNAM- 另请参阅:
-
LOCEXT
static final int LOCEXT- 另请参阅:
-
EXTCRC
static final int EXTCRC- 另请参阅:
-
EXTSIZ
static final int EXTSIZ- 另请参阅:
-
EXTLEN
static final int EXTLEN- 另请参阅:
-
CENVEM
static final int CENVEM- 另请参阅:
-
CENVER
static final int CENVER- 另请参阅:
-
CENFLG
static final int CENFLG- 另请参阅:
-
CENHOW
static final int CENHOW- 另请参阅:
-
CENTIM
static final int CENTIM- 另请参阅:
-
CENCRC
static final int CENCRC- 另请参阅:
-
CENSIZ
static final int CENSIZ- 另请参阅:
-
CENLEN
static final int CENLEN- 另请参阅:
-
CENNAM
static final int CENNAM- 另请参阅:
-
CENEXT
static final int CENEXT- 另请参阅:
-
CENCOM
static final int CENCOM- 另请参阅:
-
CENDSK
static final int CENDSK- 另请参阅:
-
CENATT
static final int CENATT- 另请参阅:
-
CENATX
static final int CENATX- 另请参阅:
-
CENOFF
static final int CENOFF- 另请参阅:
-
ENDSUB
static final int ENDSUB- 另请参阅:
-
ENDTOT
static final int ENDTOT- 另请参阅:
-
ENDSIZ
static final int ENDSIZ- 另请参阅:
-
ENDOFF
static final int ENDOFF- 另请参阅:
-
ENDCOM
static final int ENDCOM- 另请参阅:
-
-
构造器详细资料
-
ZipEntry
Creates a new zip entry with the specified name.- 参数:
name- the name of the entry- 从以下版本开始:
- 1.1
-
ZipEntry
Creates a new zip entry with fields taken from the specified zip entry.- 参数:
entry- the entry to get fields from- 抛出:
ZipException- on error- 从以下版本开始:
- 1.1
-
ZipEntry
Creates a new zip entry with fields taken from the specified zip entry.- 参数:
entry- the entry to get fields from- 抛出:
ZipException- on error- 从以下版本开始:
- 1.1
-
ZipEntry
protected ZipEntry()- 从以下版本开始:
- 1.9
-
-
方法详细资料
-
clone
Overwrite clone. -
getInternalAttributes
public int getInternalAttributes()Retrieves the internal file attributes.- 返回:
- the internal file attributes
- 从以下版本开始:
- 1.1
-
setInternalAttributes
public void setInternalAttributes(int value) Sets the internal file attributes.- 参数:
value- anintvalue- 从以下版本开始:
- 1.1
-
getExternalAttributes
public long getExternalAttributes()Retrieves the external file attributes.- 返回:
- the external file attributes
- 从以下版本开始:
- 1.1
-
setExternalAttributes
public void setExternalAttributes(long value) Sets the external file attributes.- 参数:
value- anlongvalue- 从以下版本开始:
- 1.1
-
setUnixMode
public void setUnixMode(int mode) Sets Unix permissions in a way that is understood by Info-Zip's unzip command.- 参数:
mode- anintvalue- 从以下版本开始:
- Ant 1.5.2
-
getUnixMode
public int getUnixMode()Unix permission.- 返回:
- the unix permissions
- 从以下版本开始:
- Ant 1.6
-
getPlatform
public int getPlatform()Platform specification to put into the "version made by" part of the central file header.- 返回:
- PLATFORM_FAT unless
setUnixModehas been called, in which case PLATORM_UNIX will be returned. - 从以下版本开始:
- Ant 1.5.2
-
setPlatform
protected void setPlatform(int platform) Set the platform (UNIX or FAT).- 参数:
platform- anintvalue - 0 is FAT, 3 is UNIX- 从以下版本开始:
- 1.9
-
setExtraFields
Replaces all currently attached extra fields with the new array.- 参数:
fields- an array of extra fields- 从以下版本开始:
- 1.1
-
getExtraFields
Retrieves all extra fields that have been parsed successfully.- 返回:
- an array of the extra fields
-
getExtraFields
Retrieves extra fields.- 参数:
includeUnparseable- whether to also return unparseable extra fields asUnparseableExtraFieldDataif such data exists.- 返回:
- an array of the extra fields
- 从以下版本开始:
- 1.1
-
addExtraField
Adds an extra field - replacing an already present extra field of the same type.If no extra field of the same type exists, the field will be added as last field.
- 参数:
ze- an extra field- 从以下版本开始:
- 1.1
-
addAsFirstExtraField
Adds an extra field - replacing an already present extra field of the same type.The new extra field will be the first one.
- 参数:
ze- an extra field- 从以下版本开始:
- 1.1
-
removeExtraField
Remove an extra field.- 参数:
type- the type of extra field to remove- 从以下版本开始:
- 1.1
-
removeUnparseableExtraFieldData
public void removeUnparseableExtraFieldData()Removes unparseable extra field data. -
getExtraField
Looks up an extra field by its header id.- 参数:
type- ZipShort- 返回:
- null if no such field exists.
-
getUnparseableExtraFieldData
Looks up extra field data that couldn't be parsed correctly.- 返回:
- null if no such field exists.
-
setExtra
Parses the given bytes as extra field data and consumes any unparseable data as anUnparseableExtraFieldDatainstance.- 覆盖:
setExtra在类中ZipEntry- 参数:
extra- an array of bytes to be parsed into extra fields- 抛出:
RuntimeException- if the bytes cannot be parsedRuntimeException- on error- 从以下版本开始:
- 1.1
-
setExtra
protected void setExtra()Unfortunatelyjava.util.zip.ZipOutputStreamseems to access the extra data directly, so overriding getExtra doesn't help - we need to modify super's data directly.- 从以下版本开始:
- 1.1
-
setCentralDirectoryExtra
public void setCentralDirectoryExtra(byte[] b) Sets the central directory part of extra fields.- 参数:
b- byte[]
-
getLocalFileDataExtra
public byte[] getLocalFileDataExtra()Retrieves the extra data for the local file data.- 返回:
- the extra data for local file
- 从以下版本开始:
- 1.1
-
getCentralDirectoryExtra
public byte[] getCentralDirectoryExtra()Retrieves the extra data for the central directory.- 返回:
- the central directory extra data
- 从以下版本开始:
- 1.1
-
setComprSize
public void setComprSize(long size) Make this class work in JDK 1.1 like a 1.2 class.This either stores the size for later usage or invokes setCompressedSize via reflection.
- 参数:
size- the size to use Use setCompressedSize directly.- 从以下版本开始:
- 1.2
-
getName
Get the name of the entry. -
isDirectory
public boolean isDirectory()Is this entry a directory?- 覆盖:
isDirectory在类中ZipEntry- 返回:
- true if the entry is a directory
- 从以下版本开始:
- 1.10
-
setName
Set the name of the entry.- 参数:
name- the name to use
-
hashCode
public int hashCode()Get the hashCode of the entry. This uses the name as the hashcode. -
equals
The equality method. In this case, the implementation returns 'this == o' which is basically the equals method of the Object class.
-