diff options
author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-20 05:46:20 +0000 |
---|---|---|
committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-20 05:46:20 +0000 |
commit | 5637a05bef6ec69145eab52a03cf57fc90f1f9d7 (patch) | |
tree | 27d4b9e24e07c9c46ef69c5bd1e869b1bd12ecea /libjava/java/util/zip/ZipEntry.java | |
parent | 1503f2a0160ca5f00b4d19eb9291ac40857ee44d (diff) | |
download | ppe42-gcc-5637a05bef6ec69145eab52a03cf57fc90f1f9d7.tar.gz ppe42-gcc-5637a05bef6ec69145eab52a03cf57fc90f1f9d7.zip |
2000-05-20 Bryce McKinlay <bryce@albatross.co.nz>
* java/util/zip/ZipEntry.java: Implement Cloneable, per JDK1.2 docs.
(ZipEntry): Copy the Name' field.
(clone): Implement JDK1.2 method.
(setCompressedSize): ditto.
(hashCode): ditto.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34043 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/util/zip/ZipEntry.java')
-rw-r--r-- | libjava/java/util/zip/ZipEntry.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/libjava/java/util/zip/ZipEntry.java b/libjava/java/util/zip/ZipEntry.java index 9ff7f4d7c66..cf8d98b4445 100644 --- a/libjava/java/util/zip/ZipEntry.java +++ b/libjava/java/util/zip/ZipEntry.java @@ -19,7 +19,7 @@ package java.util.zip; * Status: Believed complete and correct. */ -public class ZipEntry implements ZipConstants +public class ZipEntry implements ZipConstants, Cloneable { // These values were determined using a simple test program. public static final int STORED = 0; @@ -51,10 +51,20 @@ public class ZipEntry implements ZipConstants crc = ent.crc; extra = ent.extra; method = ent.method; + name = ent.name; size = ent.size; time = ent.time; relativeOffset = ent.relativeOffset; } + + public Object clone () + { + // JCL defines this as being the same as the copy constructor above, + // except that value of the "extra" field is also copied. + ZipEntry clone = new ZipEntry (this); + clone.extra = (byte[]) extra.clone (); + return clone; + } public String getComment () { return comment; } @@ -89,6 +99,13 @@ public class ZipEntry implements ZipConstants throw new IllegalArgumentException (); this.comment = comment; } + + public void setCompressedSize (long compressedSize) + { + if (size < 0 || size > 0xffffffffL) + throw new IllegalArgumentException (); + this.compressedSize = compressedSize; + } public void setCrc (long crc) { @@ -155,4 +172,6 @@ public class ZipEntry implements ZipConstants } public String toString () { return name; } + + public int hashCode () { return name.hashCode (); } } |