public class ZipEntry extends Object implements Cloneable
ZipEntry
represents an entry within a ZIP-archive.
An entry has attributes such as name (= path) or the size of its data. While
an entry identifies data stored in an archive, it does not hold the data
itself. For example when reading a ZIP-file you will first retrieve
all its entries in a collection and then read the data for a specific entry
through an input stream.ZipFile
,
ZipOutputStream
Modifier and Type | Field and Description |
---|---|
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 |
DEFLATED
Zip entry state: Deflated.
|
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 |
STORED
Zip entry state: Stored.
|
Constructor and Description |
---|
ZipEntry(String name)
Constructs a new
ZipEntry with the specified name. |
ZipEntry(ZipEntry ze)
Constructs a new
ZipEntry using the values obtained from ze . |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Returns a deep copy of this zip entry.
|
String |
getComment()
Gets the comment for this
ZipEntry . |
long |
getCompressedSize()
Gets the compressed size of this
ZipEntry . |
long |
getCrc()
Gets the checksum for this
ZipEntry . |
byte[] |
getExtra()
Gets the extra information for this
ZipEntry . |
int |
getMethod()
Gets the compression method for this
ZipEntry . |
String |
getName()
Gets the name of this
ZipEntry . |
long |
getSize()
Gets the uncompressed size of this
ZipEntry . |
long |
getTime()
Gets the last modification time of this
ZipEntry . |
int |
hashCode()
Returns the hash code for this
ZipEntry . |
boolean |
isDirectory()
Determine whether or not this
ZipEntry is a directory. |
void |
setComment(String comment)
Sets the comment for this
ZipEntry . |
void |
setCompressedSize(long value)
Sets the compressed size for this
ZipEntry . |
void |
setCrc(long value)
Sets the checksum for this
ZipEntry . |
void |
setExtra(byte[] data)
Sets the extra information for this
ZipEntry . |
void |
setMethod(int value)
Sets the compression method for this
ZipEntry . |
void |
setSize(long value)
Sets the uncompressed size of this
ZipEntry . |
void |
setTime(long value)
Sets the modification time of this
ZipEntry . |
String |
toString()
Returns the string representation of this
ZipEntry . |
public static final int DEFLATED
public static final int STORED
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(String name)
ZipEntry
with the specified name.name
- the name of the ZIP entry.IllegalArgumentException
- if the name length is outside the range (> 0xFFFF).public ZipEntry(ZipEntry ze)
ZipEntry
using the values obtained from ze
.ze
- the ZipEntry
from which to obtain values.public String getComment()
ZipEntry
.ZipEntry
, or null
if there
is no comment. If we're reading an archive with
ZipInputStream
the comment is not available.public long getCompressedSize()
ZipEntry
.public long getCrc()
ZipEntry
.public byte[] getExtra()
ZipEntry
.null
if
there is none.public int getMethod()
ZipEntry
.DEFLATED
, STORED
or -1 if the compression method has not been set.public String getName()
ZipEntry
.public long getSize()
ZipEntry
.-1
if the size has not been
set.public long getTime()
ZipEntry
.public boolean isDirectory()
ZipEntry
is a directory.true
when this ZipEntry
is a directory, false
otherwise.public void setComment(String comment)
ZipEntry
.comment
- the comment for this entry.public void setCompressedSize(long value)
ZipEntry
.value
- the compressed size (in bytes).public void setCrc(long value)
ZipEntry
.value
- the checksum for this entry.IllegalArgumentException
- if value
is < 0 or > 0xFFFFFFFFL.public void setExtra(byte[] data)
ZipEntry
.data
- a byte array containing the extra information.IllegalArgumentException
- when the length of data is greater than 0xFFFF bytes.public void setMethod(int value)
ZipEntry
.value
- the compression method, either DEFLATED
or STORED
.IllegalArgumentException
- when value is not DEFLATED
or STORED
.public void setSize(long value)
ZipEntry
.value
- the uncompressed size for this entry.IllegalArgumentException
- if value
< 0 or value
> 0xFFFFFFFFL.public void setTime(long value)
ZipEntry
.value
- the modification time as the number of milliseconds since Jan.
1, 1970.public String toString()
ZipEntry
.public Object clone()
public int hashCode()
ZipEntry
.hashCode
in class Object
Object.equals(java.lang.Object)