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
This commit is contained in:
parent
ee7ea78d2a
commit
ee2f99a584
@ -1,3 +1,11 @@
|
||||
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.
|
||||
|
||||
2000-05-19 Tom Tromey <tromey@cygnus.com>
|
||||
|
||||
* java/io/BufferedWriter.java: Merged with Classpath.
|
||||
|
@ -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 (); }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user