java.util.zip.ZipEntry
java.lang.Object
None
None
New as of JDK 1.1
The ZipEntry class represents a single entry in a ZIP file, which is either a compressed file or an uncompressed file. ZipEntry provides methods that set and retrieve various pieces of information about an entry.
When you are reading a ZIP file, you use ZipInputStream.getNextEntry() to return the next entry in the file. Then you can retrieve information about that particular entry. You can also read the entries in a ZIP file in a nonsequential order using the ZipFile class.
When you are writing a ZIP file, you use ZipOutputStream.putNextEntry() to write an entry, and you must create your own ZipEntry objects. If you are storing compressed (deflated) files, you need only specify a name for the ZipEntry ; the other fields are filled in automatically. If, however, you are placing uncompressed entries, you need to specify the size of each entry and provide a CRC-32 checksum value.
public class java.util.zip.ZipEntry extends java.lang.Object { // Constants public static final int DEFLATED; public static final int STORED; // Constructors public ZipEntry(String name); // Instance Methods public String getComment(); public long getCompressedSize(); public long getCrc(); public byte[] getExtra(); public int getMethod(); public String getName(); public long getSize(); public long getTime(); public boolean isDirectory(); public void setComment(String comment); public void setCrc(long crc); public void setExtra(byte[] extra); public void setMethod(int method); public void setSize(long size); public void setTime(long time); public String toString(); }
A constant that represents an entry that is stored using the deflate algorithm.
A constant that represents an entry that is stored verbatim; in other words, with no compression applied.
The name of the entry.
If name is null.
If name is longer than 0xFFFF bytes.
This constructor creates a ZipEntry with the given name.
The comment of this entry or null if one has not been specified.
This method returns the comment string for this ZipEntry.
The compressed size of this entry or -1 is the compressed size is not known.
This method returns the compressed size of this ZipEntry.
The checksum value for this entry.
This method returns the CRC-32 checksum value for this ZipEntry.
The extra field data for this entry or null if there is none.
This method returns the bytes in the extra field data for this ZipEntry.
The compression method of this entry or -1 if it has not been specified.
This method returns the compression method of this ZipEntry. Valid values are DEFLATED and STORED.
The name of this entry.
This method returns the string name of this ZipEntry.
The uncompressed size of this entry or -1 if the uncompressed size is not known.
This method returns the uncompressed size of this ZipEntry.
The modification date of this entry.
This method returns the modification date of this ZipEntry as the number of milliseconds since midnight, January 1, 1970 GMT.
A boolean value that indicates whether or not this entry is a directory.
This method returns true if this ZipEntry represents a directory.
The new comment string.
If comment is longer than 0xFFFF bytes.
This method sets the comment string of this ZipEntry.
The new checksum value.
This method sets the CRC-32 checksum value for this ZipEntry.
The extra field data.
If extra is longer than 0xFFFF bytes.
This method sets the extra field data for this ZipEntry.
The new compression method.
If method is not DEFLATED or STORED.
This method sets the compression method of this ZipEntry. This corresponds to the compression level of Deflater.
The new uncompressed entry size.
If size is less than 0 or greater than 0xFFFFFFFF bytes.
This method sets the uncompressed size of this ZipEntry.
The new modification date, expressed as the number of seconds since midnight, January 1, 1970 GMT.
This method sets the modification date of this ZipEntry.
A string representation of this object.
Object.toString()
This method returns the name of this ZipEntry.
Method |
Inherited From |
Method |
Inherited From |
---|---|---|---|
clone() |
Object |
equals(Object) |
Object |
finalize() |
Object |
getClass() |
Object |
hashCode() |
Object |
notify() |
Object |
notifyAll() |
Object |
wait() |
Object |
wait(long) |
Object |
wait(long, int) |
Object |
Deflater, IllegalArgumentException, Inflater, NullPointerException, ZipInputStream, ZipOutputStream