java.lang.Object | |
↳ | java.util.zip.ZipEntry |
Known Direct Subclasses |
An entry within a zip file.
An entry has attributes such as its name (which is actually a path) and the uncompressed size
of the corresponding data. An entry does not contain the data itself, but can be used as a key
with getInputStream(ZipEntry)
. The class documentation for ZipInputStream
and
ZipOutputStream
shows how ZipEntry
is used in conjunction with those two classes.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | CENATT | ||||||||||
int | CENATX | ||||||||||
int | CENCOM | ||||||||||
int | CENCRC | ||||||||||
int | CENDSK | ||||||||||
int | CENEXT | ||||||||||
int | CENFLG | ||||||||||
int | CENHDR | ||||||||||
int | CENHOW | ||||||||||
int | CENLEN | ||||||||||
int | CENNAM | ||||||||||
int | CENOFF | ||||||||||
long | CENSIG | ||||||||||
int | CENSIZ | ||||||||||
int | CENTIM | ||||||||||
int | CENVEM | ||||||||||
int | CENVER | ||||||||||
int | DEFLATED | Zip entry state: Deflated. | |||||||||
int | ENDCOM | ||||||||||
int | ENDHDR | ||||||||||
int | ENDOFF | ||||||||||
long | ENDSIG | ||||||||||
int | ENDSIZ | ||||||||||
int | ENDSUB | ||||||||||
int | ENDTOT | ||||||||||
int | EXTCRC | ||||||||||
int | EXTHDR | ||||||||||
int | EXTLEN | ||||||||||
long | EXTSIG | ||||||||||
int | EXTSIZ | ||||||||||
int | LOCCRC | ||||||||||
int | LOCEXT | ||||||||||
int | LOCFLG | ||||||||||
int | LOCHDR | ||||||||||
int | LOCHOW | ||||||||||
int | LOCLEN | ||||||||||
int | LOCNAM | ||||||||||
long | LOCSIG | ||||||||||
int | LOCSIZ | ||||||||||
int | LOCTIM | ||||||||||
int | LOCVER | ||||||||||
int | STORED | Zip entry state: Stored. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new
ZipEntry with the specified name.
| |||||||||||
Constructs a new
ZipEntry using the values obtained from ze .
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns a deep copy of this zip entry.
| |||||||||||
Returns the comment for this
ZipEntry , or null if there is no comment.
| |||||||||||
Gets the compressed size of this
ZipEntry .
| |||||||||||
Gets the checksum for this
ZipEntry .
| |||||||||||
Gets the extra information for this
ZipEntry .
| |||||||||||
Gets the compression method for this
ZipEntry .
| |||||||||||
Gets the name of this
ZipEntry .
| |||||||||||
Gets the uncompressed size of this
ZipEntry .
| |||||||||||
Gets the last modification time of this
ZipEntry .
| |||||||||||
Returns the hash code for this
ZipEntry .
| |||||||||||
Determine whether or not this
ZipEntry is a directory.
| |||||||||||
Sets the comment for this
ZipEntry .
| |||||||||||
Sets the compressed size for this
ZipEntry .
| |||||||||||
Sets the checksum for this
ZipEntry .
| |||||||||||
Sets the extra information for this
ZipEntry .
| |||||||||||
Sets the compression method for this entry to either
DEFLATED or STORED .
| |||||||||||
Sets the uncompressed size of this
ZipEntry .
| |||||||||||
Sets the modification time of this
ZipEntry .
| |||||||||||
Returns the string representation of this
ZipEntry .
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Zip entry state: Deflated.
Zip entry state: Stored.
Constructs a new ZipEntry
with the specified name. The name is actually a path,
and may contain /
characters.
IllegalArgumentException | if the name length is outside the range (> 0xFFFF). |
---|
Constructs a new ZipEntry
using the values obtained from ze
.
ze | the ZipEntry from which to obtain values.
|
---|
Returns a deep copy of this zip entry.
Returns the comment for this ZipEntry
, or null
if there is no comment.
If we're reading a zip file using ZipInputStream
, the comment is not available.
Gets the compressed size of this ZipEntry
.
Gets the checksum for this ZipEntry
.
Gets the extra information for this ZipEntry
.
null
if
there is none.
Gets the compression method for this ZipEntry
.
DEFLATED
, STORED
or -1 if the compression method has not been set.
Gets the name of this ZipEntry
.
Security note: Entry names can represent relative paths. foo/../bar
or
../bar/baz
, for example. If the entry name is being used to construct a filename
or as a path component, it must be validated or sanitized to ensure that files are not
written outside of the intended destination directory.
Gets the uncompressed size of this ZipEntry
.
-1
if the size has not been
set.
Gets the last modification time of this ZipEntry
.
Returns the hash code for this ZipEntry
.
Determine whether or not this ZipEntry
is a directory.
true
when this ZipEntry
is a directory, false
otherwise.
Sets the comment for this ZipEntry
.
IllegalArgumentException | if the comment is >= 64 Ki UTF-8 bytes. |
---|
Sets the compressed size for this ZipEntry
.
value | the compressed size (in bytes). |
---|
Sets the checksum for this ZipEntry
.
value | the checksum for this entry. |
---|
IllegalArgumentException | if value is < 0 or > 0xFFFFFFFFL.
|
---|
Sets the extra information for this ZipEntry
.
IllegalArgumentException | if the data length >= 64 KiB. |
---|
Sets the compression method for this entry to either DEFLATED
or STORED
.
The default is DEFLATED
, which will cause the size, compressed size, and CRC to be
set automatically, and the entry's data to be compressed. If you switch to STORED
note that you'll have to set the size (or compressed size; they must be the same, but it's
okay to only set one) and CRC yourself because they must appear before the user data
in the resulting zip file. See setSize(long)
and setCrc(long)
.
IllegalArgumentException | when value is not DEFLATED or STORED .
|
---|
Sets the uncompressed size of this ZipEntry
.
value | the uncompressed size for this entry. |
---|
IllegalArgumentException | if value < 0 .
|
---|
Sets the modification time of this ZipEntry
.
value | the modification time as the number of milliseconds since Jan. 1, 1970. |
---|
Returns the string representation of this ZipEntry
.
ZipEntry
.