home *** CD-ROM | disk | FTP | other *** search
- package java.util.zip;
-
- import java.security.AccessController;
- import java.util.Date;
- import sun.security.action.LoadLibraryAction;
-
- public class ZipEntry implements ZipConstants, Cloneable {
- String name;
- long time = -1L;
- long crc = -1L;
- long size = -1L;
- long csize = -1L;
- int method = -1;
- byte[] extra;
- String comment;
- int flag;
- int version;
- long offset;
- public static final int STORED = 0;
- public static final int DEFLATED = 8;
-
- private static native void initIDs();
-
- public ZipEntry(String var1) {
- if (var1 == null) {
- throw new NullPointerException();
- } else if (var1.length() > 65535) {
- throw new IllegalArgumentException("entry name too long");
- } else {
- this.name = var1;
- }
- }
-
- public ZipEntry(ZipEntry var1) {
- this.name = var1.name;
- this.time = var1.time;
- this.crc = var1.crc;
- this.size = var1.size;
- this.csize = var1.csize;
- this.method = var1.method;
- this.extra = var1.extra;
- this.comment = var1.comment;
- }
-
- ZipEntry(String var1, long var2) {
- this.name = var1;
- this.initFields(var2);
- }
-
- private native void initFields(long var1);
-
- ZipEntry(long var1) {
- this.initFields(var1);
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setTime(long var1) {
- this.time = javaToDosTime(var1);
- }
-
- public long getTime() {
- return this.time != -1L ? dosToJavaTime(this.time) : -1L;
- }
-
- public void setSize(long var1) {
- if (var1 >= 0L && var1 <= 4294967295L) {
- this.size = var1;
- } else {
- throw new IllegalArgumentException("invalid entry size");
- }
- }
-
- public long getSize() {
- return this.size;
- }
-
- public long getCompressedSize() {
- return this.csize;
- }
-
- public void setCompressedSize(long var1) {
- this.csize = var1;
- }
-
- public void setCrc(long var1) {
- if (var1 >= 0L && var1 <= 4294967295L) {
- this.crc = var1;
- } else {
- throw new IllegalArgumentException("invalid entry crc-32");
- }
- }
-
- public long getCrc() {
- return this.crc;
- }
-
- public void setMethod(int var1) {
- if (var1 != 0 && var1 != 8) {
- throw new IllegalArgumentException("invalid compression method");
- } else {
- this.method = var1;
- }
- }
-
- public int getMethod() {
- return this.method;
- }
-
- public void setExtra(byte[] var1) {
- if (var1 != null && var1.length > 65535) {
- throw new IllegalArgumentException("invalid extra field length");
- } else {
- this.extra = var1;
- }
- }
-
- public byte[] getExtra() {
- return this.extra;
- }
-
- public void setComment(String var1) {
- if (var1 != null && var1.length() > 65535) {
- throw new IllegalArgumentException("invalid entry comment length");
- } else {
- this.comment = var1;
- }
- }
-
- public String getComment() {
- return this.comment;
- }
-
- public boolean isDirectory() {
- return this.name.endsWith("/");
- }
-
- public String toString() {
- return this.getName();
- }
-
- private static long dosToJavaTime(long var0) {
- Date var2 = new Date((int)((var0 >> 25 & 127L) + 80L), (int)((var0 >> 21 & 15L) - 1L), (int)(var0 >> 16 & 31L), (int)(var0 >> 11 & 31L), (int)(var0 >> 5 & 63L), (int)(var0 << 1 & 62L));
- return var2.getTime();
- }
-
- private static long javaToDosTime(long var0) {
- Date var2 = new Date(var0);
- int var3 = var2.getYear() + 1900;
- return var3 < 1980 ? 2162688L : (long)(var3 - 1980 << 25 | var2.getMonth() + 1 << 21 | var2.getDate() << 16 | var2.getHours() << 11 | var2.getMinutes() << 5 | var2.getSeconds() >> 1);
- }
-
- public int hashCode() {
- return this.name.hashCode();
- }
-
- public Object clone() {
- try {
- ZipEntry var1 = (ZipEntry)super.clone();
- var1.extra = this.extra == null ? null : (byte[])this.extra.clone();
- return var1;
- } catch (CloneNotSupportedException var2) {
- throw new InternalError();
- }
- }
-
- static {
- AccessController.doPrivileged(new LoadLibraryAction("zip"));
- initIDs();
- }
- }
-