public class ZipEntry
extends java.util.zip.ZipEntry
implements java.lang.Cloneable
The extra data is expected to follow the recommendation of the .ZIP File Format Specification created by PKWARE Inc. :
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 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 |
static int |
PLATFORM_FAT |
static int |
PLATFORM_UNIX |
构造器和说明 |
---|
ZipEntry(java.lang.String name)
Creates a new zip entry with the specified name.
|
ZipEntry(java.util.zip.ZipEntry entry)
Creates a new zip entry with fields taken from the specified zip entry.
|
ZipEntry(ZipEntry entry)
Creates a new zip entry with fields taken from the specified zip entry.
|
限定符和类型 | 方法和说明 |
---|---|
void |
addAsFirstExtraField(ZipExtraField ze)
Adds an extra field - replacing an already present extra field
of the same type.
|
void |
addExtraField(ZipExtraField ze)
Adds an extra field - replacing an already present extra field
of the same type.
|
java.lang.Object |
clone()
Overwrite clone.
|
boolean |
equals(java.lang.Object o)
The equality method.
|
byte[] |
getCentralDirectoryExtra()
Retrieves the extra data for the central directory.
|
long |
getExternalAttributes()
Retrieves the external file attributes.
|
ZipExtraField |
getExtraField(ZipShort type)
Looks up an extra field by its header id.
|
ZipExtraField[] |
getExtraFields()
Retrieves all extra fields that have been parsed successfully.
|
ZipExtraField[] |
getExtraFields(boolean includeUnparseable)
Retrieves extra fields.
|
int |
getInternalAttributes()
Retrieves the internal file attributes.
|
byte[] |
getLocalFileDataExtra()
Retrieves the extra data for the local file data.
|
java.lang.String |
getName()
Get the name of the entry.
|
int |
getPlatform()
Platform specification to put into the "version made
by" part of the central file header.
|
int |
getUnixMode()
Unix permission.
|
UnparseableExtraFieldData |
getUnparseableExtraFieldData()
Looks up extra field data that couldn't be parsed correctly.
|
int |
hashCode()
Get the hashCode of the entry.
|
boolean |
isDirectory()
Is this entry a directory?
|
void |
removeExtraField(ZipShort type)
Remove an extra field.
|
void |
removeUnparseableExtraFieldData()
Removes unparseable extra field data.
|
void |
setCentralDirectoryExtra(byte[] b)
Sets the central directory part of extra fields.
|
void |
setComprSize(long size)
已过时。
since 1.7.
Use setCompressedSize directly.
|
void |
setExternalAttributes(long value)
Sets the external file attributes.
|
void |
setExtra(byte[] extra)
Parses the given bytes as extra field data and consumes any
unparseable data as an
UnparseableExtraFieldData
instance. |
void |
setExtraFields(ZipExtraField[] fields)
Replaces all currently attached extra fields with the new array.
|
void |
setInternalAttributes(int value)
Sets the internal file attributes.
|
void |
setUnixMode(int mode)
Sets Unix permissions in a way that is understood by Info-Zip's
unzip command.
|
public static final int PLATFORM_UNIX
public static final int PLATFORM_FAT
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 ZipEntry(java.lang.String name)
name
- the name of the entrypublic ZipEntry(java.util.zip.ZipEntry entry) throws java.util.zip.ZipException
entry
- the entry to get fields fromjava.util.zip.ZipException
- on errorpublic ZipEntry(ZipEntry entry) throws java.util.zip.ZipException
entry
- the entry to get fields fromjava.util.zip.ZipException
- on errorpublic java.lang.Object clone()
clone
在类中 java.util.zip.ZipEntry
public int getInternalAttributes()
public void setInternalAttributes(int value)
value
- an int
valuepublic long getExternalAttributes()
public void setExternalAttributes(long value)
value
- an long
valuepublic void setUnixMode(int mode)
mode
- an int
valuepublic int getUnixMode()
public int getPlatform()
setUnixMode
has been called, in which case PLATORM_UNIX will be returned.public void setExtraFields(ZipExtraField[] fields)
fields
- an array of extra fieldspublic ZipExtraField[] getExtraFields()
public ZipExtraField[] getExtraFields(boolean includeUnparseable)
includeUnparseable
- whether to also return unparseable
extra fields as UnparseableExtraFieldData
if such data
exists.public void addExtraField(ZipExtraField ze)
If no extra field of the same type exists, the field will be added as last field.
ze
- an extra fieldpublic void addAsFirstExtraField(ZipExtraField ze)
The new extra field will be the first one.
ze
- an extra fieldpublic void removeExtraField(ZipShort type)
type
- the type of extra field to removepublic void removeUnparseableExtraFieldData()
public ZipExtraField getExtraField(ZipShort type)
type
- ZipShortpublic UnparseableExtraFieldData getUnparseableExtraFieldData()
public void setExtra(byte[] extra) throws java.lang.RuntimeException
UnparseableExtraFieldData
instance.setExtra
在类中 java.util.zip.ZipEntry
extra
- an array of bytes to be parsed into extra fieldsjava.lang.RuntimeException
- if the bytes cannot be parsedjava.lang.RuntimeException
- on errorpublic void setCentralDirectoryExtra(byte[] b)
b
- byte[]public byte[] getLocalFileDataExtra()
public byte[] getCentralDirectoryExtra()
public void setComprSize(long size)
This either stores the size for later usage or invokes setCompressedSize via reflection.
size
- the size to usepublic java.lang.String getName()
getName
在类中 java.util.zip.ZipEntry
public boolean isDirectory()
isDirectory
在类中 java.util.zip.ZipEntry
public int hashCode()
hashCode
在类中 java.util.zip.ZipEntry
public boolean equals(java.lang.Object o)
equals
在类中 java.lang.Object
o
- the object to compare too