Methods Summary |
---|
public java.lang.Object | clone()Returns a copy of this entry.
try {
ZipEntry e = (ZipEntry)super.clone();
e.extra = (extra == null ? null : (byte[])extra.clone());
return e;
} catch (CloneNotSupportedException e) {
// This should never happen, since we are Cloneable
throw new InternalError();
}
|
private static long | dosToJavaTime(long dtime)
Date d = new Date((int)(((dtime >> 25) & 0x7f) + 80),
(int)(((dtime >> 21) & 0x0f) - 1),
(int)((dtime >> 16) & 0x1f),
(int)((dtime >> 11) & 0x1f),
(int)((dtime >> 5) & 0x3f),
(int)((dtime << 1) & 0x3e));
return d.getTime();
|
public java.lang.String | getComment()Returns the comment string for the entry, or null if none.
return comment;
|
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.
return csize;
|
public long | getCrc()Returns the CRC-32 checksum of the uncompressed entry data, or -1 if
not known.
return crc;
|
public byte[] | getExtra()Returns the extra field data for the entry, or null if none.
return extra;
|
public int | getMethod()Returns the compression method of the entry, or -1 if not specified.
return method;
|
public java.lang.String | getName()Returns the name of the entry.
return name;
|
public long | getSize()Returns the uncompressed size of the entry data, or -1 if not known.
return size;
|
public long | getTime()Returns the modification time of the entry, or -1 if not specified.
return time != -1 ? dosToJavaTime(time) : -1;
|
public int | hashCode()Returns the hash code value for this entry.
return name.hashCode();
|
private native void | initFields(long jzentry)
|
private static native void | initIDs()
|
public boolean | isDirectory()Returns true if this is a directory entry. A directory entry is
defined to be one whose name ends with a '/'.
return name.endsWith("/");
|
private static long | javaToDosTime(long time)
Date d = new Date(time);
int year = d.getYear() + 1900;
if (year < 1980) {
return (1 << 21) | (1 << 16);
}
return (year - 1980) << 25 | (d.getMonth() + 1) << 21 |
d.getDate() << 16 | d.getHours() << 11 | d.getMinutes() << 5 |
d.getSeconds() >> 1;
|
public void | setComment(java.lang.String comment)Sets the optional comment string for the entry.
if (comment != null && comment.length() > 0xffff/3
&& ZipOutputStream.getUTF8Length(comment) > 0xffff) {
throw new IllegalArgumentException("invalid entry comment length");
}
this.comment = comment;
|
public void | setCompressedSize(long csize)Sets the size of the compressed entry data.
this.csize = csize;
|
public void | setCrc(long crc)Sets the CRC-32 checksum of the uncompressed entry data.
if (crc < 0 || crc > 0xFFFFFFFFL) {
throw new IllegalArgumentException("invalid entry crc-32");
}
this.crc = crc;
|
public void | setExtra(byte[] extra)Sets the optional extra field data for the entry.
if (extra != null && extra.length > 0xFFFF) {
throw new IllegalArgumentException("invalid extra field length");
}
this.extra = extra;
|
public void | setMethod(int method)Sets the compression method for the entry.
if (method != STORED && method != DEFLATED) {
throw new IllegalArgumentException("invalid compression method");
}
this.method = method;
|
public void | setSize(long size)Sets the uncompressed size of the entry data.
if (size < 0 || size > 0xFFFFFFFFL) {
throw new IllegalArgumentException("invalid entry size");
}
this.size = size;
|
public void | setTime(long time)Sets the modification time of the entry.
this.time = javaToDosTime(time);
|
public java.lang.String | toString()Returns a string representation of the ZIP entry.
return getName();
|