summaryrefslogtreecommitdiff
path: root/java/util/zip/ZipEntry.java
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2004-12-10 13:59:13 +0000
committerMark Wielaard <mark@klomp.org>2004-12-10 13:59:13 +0000
commit447e665c6837ff5cdffaab07d9b2dfb4b806dd24 (patch)
tree7cef14ed94278db17b99e047763a0452d7032009 /java/util/zip/ZipEntry.java
parent53f05be4d64cdf5d005c95dfa887ad7e285c4b16 (diff)
downloadclasspath-447e665c6837ff5cdffaab07d9b2dfb4b806dd24.tar.gz
* java/util/zip/ZipEntry.java (KNOWN_EXTRA): New static field.
(setExtra): Don't parse bytes. (parseExtra): New private method. (getTime): Call parseExtra.
Diffstat (limited to 'java/util/zip/ZipEntry.java')
-rw-r--r--java/util/zip/ZipEntry.java23
1 files changed, 21 insertions, 2 deletions
diff --git a/java/util/zip/ZipEntry.java b/java/util/zip/ZipEntry.java
index 201a671bc..9f5aae8f5 100644
--- a/java/util/zip/ZipEntry.java
+++ b/java/util/zip/ZipEntry.java
@@ -55,6 +55,7 @@ public class ZipEntry implements ZipConstants, Cloneable
private static final int KNOWN_CSIZE = 2;
private static final int KNOWN_CRC = 4;
private static final int KNOWN_TIME = 8;
+ private static final int KNOWN_EXTRA = 16;
private static Calendar cal;
@@ -186,7 +187,10 @@ public class ZipEntry implements ZipConstants, Cloneable
{
if ((known & KNOWN_TIME) == 0)
return -1;
-
+
+ // The extra bytes might contain the time (posix/unix extension)
+ parseExtra ();
+
int sec = 2 * (dostime & 0x1f);
int min = (dostime >> 5) & 0x3f;
int hrs = (dostime >> 11) & 0x1f;
@@ -317,10 +321,23 @@ public class ZipEntry implements ZipConstants, Cloneable
this.extra = null;
return;
}
-
if (extra.length > 0xffff)
throw new IllegalArgumentException();
this.extra = extra;
+ }
+
+ private void parseExtra()
+ {
+ // Already parsed?
+ if ((known & KNOWN_EXTRA) != 0)
+ return;
+
+ if (extra == null)
+ {
+ known |= KNOWN_EXTRA;
+ return;
+ }
+
try
{
int pos = 0;
@@ -351,6 +368,8 @@ public class ZipEntry implements ZipConstants, Cloneable
/* be lenient */
return;
}
+
+ known |= KNOWN_EXTRA;
}
/**