Package sk.iway.iwcm.system.zip
Class ZipEntry
java.lang.Object
sk.iway.iwcm.system.zip.ZipEntry
- All Implemented Interfaces:
Cloneable
This class is used to represent a ZIP file entry.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final long
static final int
static final int
static final int
static final int
static final int
Compression method for compressed (deflated) entries.static final int
static final int
static final int
static final long
static final int
static final int
static final int
static final int
static final int
static final int
static final long
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final long
static final int
static final int
static final int
static final int
Compression method for uncompressed entries. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a copy of this entry.Returns the comment string for the entry, or null if none.long
Returns the size of the compressed entry data, or -1 if not known.long
getCrc()
Returns the CRC-32 checksum of the uncompressed entry data, or -1 if not known.byte[]
getExtra()
Returns the extra field data for the entry, or null if none.int
Returns the compression method of the entry, or -1 if not specified.getName()
Returns the name of the entry.long
getSize()
Returns the uncompressed size of the entry data, or -1 if not known.long
getTime()
Returns the modification time of the entry, or -1 if not specified.int
hashCode()
Returns the hash code value for this entry.boolean
Returns true if this is a directory entry.void
setComment
(String comment) Sets the optional comment string for the entry.void
setCompressedSize
(long csize) Sets the size of the compressed entry data.void
setCrc
(long crc) Sets the CRC-32 checksum of the uncompressed entry data.void
setExtra
(byte[] extra) Sets the optional extra field data for the entry.void
setMethod
(int method) Sets the compression method for the entry.void
setSize
(long size) Sets the uncompressed size of the entry data.void
setTime
(long time) Sets the modification time of the entry.toString()
Returns a string representation of the ZIP entry.
-
Field Details
-
STORED
public static final int STOREDCompression method for uncompressed entries.- See Also:
-
DEFLATED
public static final int DEFLATEDCompression method for compressed (deflated) entries.- See Also:
-
LOCSIG
static final long LOCSIG- See Also:
-
EXTSIG
static final long EXTSIG- See Also:
-
CENSIG
static final long CENSIG- See Also:
-
ENDSIG
static final long ENDSIG- See Also:
-
LOCHDR
static final int LOCHDR- See Also:
-
EXTHDR
static final int EXTHDR- See Also:
-
CENHDR
static final int CENHDR- See Also:
-
ENDHDR
static final int ENDHDR- See Also:
-
LOCVER
static final int LOCVER- See Also:
-
LOCFLG
static final int LOCFLG- See Also:
-
LOCHOW
static final int LOCHOW- See Also:
-
LOCTIM
static final int LOCTIM- See Also:
-
LOCCRC
static final int LOCCRC- See Also:
-
LOCSIZ
static final int LOCSIZ- See Also:
-
LOCLEN
static final int LOCLEN- See Also:
-
LOCNAM
static final int LOCNAM- See Also:
-
LOCEXT
static final int LOCEXT- See Also:
-
EXTCRC
static final int EXTCRC- See Also:
-
EXTSIZ
static final int EXTSIZ- See Also:
-
EXTLEN
static final int EXTLEN- See Also:
-
CENVEM
static final int CENVEM- See Also:
-
CENVER
static final int CENVER- See Also:
-
CENFLG
static final int CENFLG- See Also:
-
CENHOW
static final int CENHOW- See Also:
-
CENTIM
static final int CENTIM- See Also:
-
CENCRC
static final int CENCRC- See Also:
-
CENSIZ
static final int CENSIZ- See Also:
-
CENLEN
static final int CENLEN- See Also:
-
CENNAM
static final int CENNAM- See Also:
-
CENEXT
static final int CENEXT- See Also:
-
CENCOM
static final int CENCOM- See Also:
-
CENDSK
static final int CENDSK- See Also:
-
CENATT
static final int CENATT- See Also:
-
CENATX
static final int CENATX- See Also:
-
CENOFF
static final int CENOFF- See Also:
-
ENDSUB
static final int ENDSUB- See Also:
-
ENDTOT
static final int ENDTOT- See Also:
-
ENDSIZ
static final int ENDSIZ- See Also:
-
ENDOFF
static final int ENDOFF- See Also:
-
ENDCOM
static final int ENDCOM- See Also:
-
-
Constructor Details
-
ZipEntry
Creates a new zip entry with the specified name.- Parameters:
name
- the entry name- Throws:
NullPointerException
- if the entry name is nullIllegalArgumentException
- if the entry name is longer than 0xFFFF bytes
-
ZipEntry
Creates a new zip entry with fields taken from the specified zip entry.- Parameters:
e
- a zip Entry object
-
-
Method Details
-
getName
Returns the name of the entry.- Returns:
- the name of the entry
-
setTime
public void setTime(long time) Sets the modification time of the entry.- Parameters:
time
- the entry modification time in number of milliseconds since the epoch- See Also:
-
getTime
public long getTime()Returns the modification time of the entry, or -1 if not specified.- Returns:
- the modification time of the entry, or -1 if not specified
- See Also:
-
setSize
public void setSize(long size) Sets the uncompressed size of the entry data.- Parameters:
size
- the uncompressed size in bytes- Throws:
IllegalArgumentException
- if the specified size is less than 0 or greater than 0xFFFFFFFF bytes- See Also:
-
getSize
public long getSize()Returns the uncompressed size of the entry data, or -1 if not known.- Returns:
- the uncompressed size of the entry data, or -1 if not known
- See Also:
-
getCompressedSize
public long getCompressedSize()Returns the size of the compressed entry data, or -1 if not known. In the case of a stored entry, the compressed size will be the same as the uncompressed size of the entry.- Returns:
- the size of the compressed entry data, or -1 if not known
- See Also:
-
setCompressedSize
public void setCompressedSize(long csize) Sets the size of the compressed entry data.- Parameters:
csize
- the compressed size to set to- See Also:
-
setCrc
public void setCrc(long crc) Sets the CRC-32 checksum of the uncompressed entry data.- Parameters:
crc
- the CRC-32 value- Throws:
IllegalArgumentException
- if the specified CRC-32 value is less than 0 or greater than 0xFFFFFFFF- See Also:
-
getCrc
public long getCrc()Returns the CRC-32 checksum of the uncompressed entry data, or -1 if not known.- Returns:
- the CRC-32 checksum of the uncompressed entry data, or -1 if not known
- See Also:
-
setMethod
public void setMethod(int method) Sets the compression method for the entry.- Parameters:
method
- the compression method, either STORED or DEFLATED- Throws:
IllegalArgumentException
- if the specified compression method is invalid- See Also:
-
getMethod
public int getMethod()Returns the compression method of the entry, or -1 if not specified.- Returns:
- the compression method of the entry, or -1 if not specified
- See Also:
-
setExtra
public void setExtra(byte[] extra) Sets the optional extra field data for the entry.- Parameters:
extra
- the extra field data bytes- Throws:
IllegalArgumentException
- if the length of the specified extra field data is greater than 0xFFFF bytes- See Also:
-
getExtra
public byte[] getExtra()Returns the extra field data for the entry, or null if none.- Returns:
- the extra field data for the entry, or null if none
- See Also:
-
setComment
Sets the optional comment string for the entry.- Parameters:
comment
- the comment string- Throws:
IllegalArgumentException
- if the length of the specified comment string is greater than 0xFFFF bytes- See Also:
-
getComment
Returns the comment string for the entry, or null if none.- Returns:
- the comment string for the entry, or null if none
- See Also:
-
isDirectory
public boolean isDirectory()Returns true if this is a directory entry. A directory entry is defined to be one whose name ends with a '/'.- Returns:
- true if this is a directory entry
-
toString
Returns a string representation of the ZIP entry. -
hashCode
public int hashCode()Returns the hash code value for this entry. -
clone
Returns a copy of this entry.
-