home *** CD-ROM | disk | FTP | other *** search
- package java.util.zip;
-
- import java.util.Date;
-
- public class ZipEntry implements ZipConstants {
- String name;
- long time = -1L;
- long crc = -1L;
- long size = -1L;
- int method = -1;
- byte[] extra;
- String comment;
- int flag;
- int version;
- long csize = -1L;
- long offset;
- public static final int STORED = 0;
- public static final int DEFLATED = 8;
-
- 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;
- }
- }
-
- ZipEntry() {
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setTime(long var1) {
- this.time = javaToDosTime(var1);
- }
-
- public long getTime() {
- return dosToJavaTime(this.time);
- }
-
- 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 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 long getCompressedSize() {
- return this.csize;
- }
-
- 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);
- }
- }
-