|
||||||||||
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.ZipEntry
public class ZipEntry
Extension that adds better handling of extra fields and provides access to the internal and external file attributes.
Field Summary | |
---|---|
private static java.lang.Object |
c_lockReflection
Helper for JDK 1.1 |
private static java.lang.reflect.Method |
c_setCompressedSizeMethod
Helper for JDK 1.1 |
private static boolean |
c_triedToGetMethod
Helper for JDK 1.1 |
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
|
private java.lang.Long |
m_compressedSize
Helper for JDK 1.1 <-> 1.2 incompatibility. |
private long |
m_externalAttributes
|
private java.util.ArrayList |
m_extraFields
|
private int |
m_internalAttributes
|
Fields inherited from class java.util.zip.ZipEntry |
---|
DEFLATED, STORED |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
void |
addExtraField(ZipExtraField extraField)
Adds an extra fields - replacing an already present extra field of the same type. |
private static void |
checkSCS()
Try to get a handle to the setCompressedSize method. |
java.lang.Object |
clone()
Overwrite clone |
byte[] |
getCentralDirectoryExtra()
Retrieves the extra data for the central directory. |
long |
getCompressedSize()
Override to make this class work in JDK 1.1 like a 1.2 class. |
long |
getExternalAttributes()
Retrieves the external file attributes. |
ZipExtraField[] |
getExtraFields()
Retrieves extra fields. |
int |
getInternalAttributes()
Retrieves the internal file attributes. |
byte[] |
getLocalFileDataExtra()
Retrieves the extra data for the local file data. |
private static boolean |
haveSetCompressedSize()
Are we running JDK 1.2 or higher? |
private static void |
performSetCompressedSize(ZipEntry entry,
long size)
Invoke setCompressedSize via reflection. |
void |
removeExtraField(ZipShort type)
Remove an extra fields. |
void |
setComprSize(long size)
Make this class work in JDK 1.1 like a 1.2 class. |
void |
setExternalAttributes(long externalAttributes)
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. |
Methods inherited from class java.util.zip.ZipEntry |
---|
getComment, getCrc, getExtra, getMethod, getName, getSize, getTime, hashCode, isDirectory, setComment, setCompressedSize, setCrc, setMethod, setSize, setTime, toString |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static java.lang.reflect.Method c_setCompressedSizeMethod
private static final java.lang.Object c_lockReflection
private static boolean c_triedToGetMethod
private final java.util.ArrayList m_extraFields
private int m_internalAttributes
private long m_externalAttributes
private java.lang.Long m_compressedSize
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 ZipEntry(java.lang.String name)
name
- the name of entrypublic ZipEntry(java.util.zip.ZipEntry entry) throws java.util.zip.ZipException
entry
- the JDK ZipEntry to adapt
java.util.zip.ZipException
- if can not create entrypublic ZipEntry(ZipEntry entry) throws java.util.zip.ZipException
entry
- the entry to adapt
java.util.zip.ZipException
- if can not create entryMethod Detail |
---|
private static void checkSCS()
private static boolean haveSetCompressedSize()
private static void performSetCompressedSize(ZipEntry entry, long size)
entry
- Description of Parametersize
- Description of Parameterpublic void setComprSize(long size)
This either stores the size for later usage or invokes setCompressedSize via reflection.
size
- The new ComprSize valuepublic void setExternalAttributes(long externalAttributes)
externalAttributes
- The new ExternalAttributes valuepublic void setExtra(byte[] extra) throws java.lang.RuntimeException
setExtra
in class java.util.zip.ZipEntry
extra
- The new Extra value
java.lang.RuntimeException
- if fail to set extra datapublic void setExtraFields(ZipExtraField[] fields)
fields
- The new ExtraFields valuepublic void setInternalAttributes(int value)
value
- The new InternalAttributes valuepublic byte[] getCentralDirectoryExtra()
public long getCompressedSize()
getCompressedSize
in class java.util.zip.ZipEntry
public long getExternalAttributes()
public ZipExtraField[] getExtraFields()
public int getInternalAttributes()
public byte[] getLocalFileDataExtra()
public void addExtraField(ZipExtraField extraField)
extraField
- The feature to be added to the ExtraField attributepublic java.lang.Object clone()
clone
in class java.util.zip.ZipEntry
public void removeExtraField(ZipShort type)
type
- Description of Parameterprotected 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |