diff options
author | Bryce McKinlay <bryce@albatross.co.nz> | 2000-05-20 05:46:20 +0000 |
---|---|---|
committer | Bryce McKinlay <bryce@gcc.gnu.org> | 2000-05-20 06:46:20 +0100 |
commit | ee2f99a584736be0ab4013ae9f1ae820fbc4cadc (patch) | |
tree | 27d4b9e24e07c9c46ef69c5bd1e869b1bd12ecea /libjava/java/util/zip/ZipEntry.java | |
parent | ee7ea78d2af74a5be5cf9737a35cc8c65cdea9c5 (diff) | |
download | gcc-ee2f99a584736be0ab4013ae9f1ae820fbc4cadc.zip gcc-ee2f99a584736be0ab4013ae9f1ae820fbc4cadc.tar.gz gcc-ee2f99a584736be0ab4013ae9f1ae820fbc4cadc.tar.bz2 |
ZipEntry.java: Implement Cloneable, per JDK1.2 docs.
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.
From-SVN: r34043
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 9ff7f4d..cf8d98b 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 (); } } |