|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.zip.ZipEntry
org.apache.commons.compress.archivers.zip.ZipArchiveEntry
public class ZipArchiveEntry
Extension that adds better handling of extra fields and provides access to the internal and external file attributes.
Field Summary | |
---|---|
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
|
Fields inherited from class java.util.zip.ZipEntry |
---|
DEFLATED, STORED |
Fields inherited from interface org.apache.commons.compress.archivers.ArchiveEntry |
---|
SIZE_UNKNOWN |
Constructor Summary | |
---|---|
protected |
ZipArchiveEntry()
|
|
ZipArchiveEntry(File inputFile,
String entryName)
|
|
ZipArchiveEntry(String name)
Creates a new zip entry with the specified name. |
|
ZipArchiveEntry(ZipArchiveEntry entry)
Creates a new zip entry with fields taken from the specified zip entry. |
|
ZipArchiveEntry(ZipEntry entry)
Creates a new zip entry with fields taken from the specified zip entry. |
Method Summary | |
---|---|
void |
addAsFirstExtraField(ZipExtraField ze)
Adds an extra fields - replacing an already present extra field of the same type. |
void |
addExtraField(ZipExtraField ze)
Adds an extra fields - replacing an already present extra field of the same type. |
Object |
clone()
Overwrite clone. |
boolean |
equals(Object obj)
|
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 extra fields. |
int |
getInternalAttributes()
Retrieves the internal file attributes. |
byte[] |
getLocalFileDataExtra()
Retrieves the extra data for the local file data. |
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. |
int |
hashCode()
Get the hashCode of the entry. |
boolean |
isDirectory()
Is this entry a directory? |
void |
removeExtraField(ZipShort type)
Remove an extra fields. |
void |
setCentralDirectoryExtra(byte[] b)
Sets the central directory part of extra fields. |
void |
setExternalAttributes(long value)
Sets the external file attributes. |
protected void |
setExtra()
Unfortunately java.util.zip.ZipOutputStream seems to access the extra data
directly, so overriding getExtra doesn't help - we need to
modify super's data directly. |
void |
setExtra(byte[] extra)
Throws an Exception if extra data cannot be parsed into extra fields. |
void |
setExtraFields(ZipExtraField[] fields)
Replaces all currently attached extra fields with the new array. |
void |
setInternalAttributes(int value)
Sets the internal file attributes. |
protected void |
setName(String name)
Set the name of the entry. |
protected void |
setPlatform(int platform)
Set the platform (UNIX or FAT). |
void |
setUnixMode(int mode)
Sets Unix permissions in a way that is understood by Info-Zip's unzip command. |
Methods inherited from class java.util.zip.ZipEntry |
---|
getComment, getCompressedSize, getCrc, getExtra, getMethod, getSize, getTime, setComment, setCompressedSize, setCrc, setMethod, setSize, setTime, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.commons.compress.archivers.ArchiveEntry |
---|
getSize |
Field Detail |
---|
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
Constructor Detail |
---|
public ZipArchiveEntry(String name)
name
- the name of the entrypublic ZipArchiveEntry(ZipEntry entry) throws ZipException
entry
- the entry to get fields from
ZipException
- on errorpublic ZipArchiveEntry(ZipArchiveEntry entry) throws ZipException
entry
- the entry to get fields from
ZipException
- on errorprotected ZipArchiveEntry()
public ZipArchiveEntry(File inputFile, String entryName)
Method Detail |
---|
public Object clone()
clone
in class 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.protected void setPlatform(int platform)
platform
- an int
value - 0 is FAT, 3 is UNIXpublic void setExtraFields(ZipExtraField[] fields)
fields
- an array of extra fieldspublic ZipExtraField[] getExtraFields()
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 ZipExtraField getExtraField(ZipShort type)
public void setExtra(byte[] extra) throws RuntimeException
setExtra
in class ZipEntry
extra
- an array of bytes to be parsed into extra fields
RuntimeException
- if the bytes cannot be parsed
RuntimeException
- on errorprotected void setExtra()
java.util.zip.ZipOutputStream
seems to access the extra data
directly, so overriding getExtra doesn't help - we need to
modify super's data directly.
public void setCentralDirectoryExtra(byte[] b)
public byte[] getLocalFileDataExtra()
public byte[] getCentralDirectoryExtra()
public String getName()
getName
in interface ArchiveEntry
getName
in class ZipEntry
public boolean isDirectory()
isDirectory
in interface ArchiveEntry
isDirectory
in class ZipEntry
protected void setName(String name)
name
- the name to usepublic int hashCode()
hashCode
in class ZipEntry
public boolean equals(Object obj)
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |