aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/util/Date.java
diff options
context:
space:
mode:
authorWarren Levy <warrenl@cygnus.com>2000-10-05 23:57:16 +0000
committerWarren Levy <warrenl@gcc.gnu.org>2000-10-05 23:57:16 +0000
commitbf3478059df1a948c6b728754150d25b1d5610b1 (patch)
treeab6da2cb575ebc39dc451d7b89674a8d23e7af54 /libjava/java/util/Date.java
parentcc0cbae17ebe0b5c9a9152cd867d2ae5a5e943db (diff)
downloadgcc-bf3478059df1a948c6b728754150d25b1d5610b1.zip
gcc-bf3478059df1a948c6b728754150d25b1d5610b1.tar.gz
gcc-bf3478059df1a948c6b728754150d25b1d5610b1.tar.bz2
Makefile.am: Removed java/io/Replaceable.java and java/io/Resolvable.java.
* Makefile.am: Removed java/io/Replaceable.java and java/io/Resolvable.java. * Makefile.in: Rebuilt. * gcj/javaprims.h: Removed Replaceable and Resolvable from java.io namespace. * java/io/ObjectInputStream.java (processResolution): Fixed typo in method name. (processResolution): Handle readResolve method via reflection with removal of Resolvable interface. * java/io/ObjectOutputStream.java (writeObject): Handle writeReplace method via reflection with removal of Replaceable interface. * java/io/Replaceable.java: Removed. * java/io/Resolvable.java: Removed. * java/security/Key.java (serialVersionUID): New field. * java/security/Provider.java (serialVersionUID): New field. * java/security/interfaces/DSAPrivateKey.java (serialVersionUID): New field. * java/security/interfaces/DSAPublicKey.java (serialVersionUID): New field. * java/sql/DataTruncation.java (serialVersionUID): New field. * java/sql/SQLException.java (serialVersionUID): New field. * java/sql/SQLWarning.java (serialVersionUID): New field. * java/util/Date.java (serialVersionUID): New field. (millis): Made transient. (readObject): New method. (writeObject): New method. Serialization mods. Note: The interfaces java.io.Replaceable and java.io.Resolvable were only temporary additions to JDK 1.2 beta versions and were not included in the JDK 1.2 final. The Serialization spec instructs how to deal with their methods (via reflection). From-SVN: r36736
Diffstat (limited to 'libjava/java/util/Date.java')
-rw-r--r--libjava/java/util/Date.java33
1 files changed, 28 insertions, 5 deletions
diff --git a/libjava/java/util/Date.java b/libjava/java/util/Date.java
index 6a8a765..4b76b8a 100644
--- a/libjava/java/util/Date.java
+++ b/libjava/java/util/Date.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
This file is part of libgcj.
@@ -18,13 +18,13 @@ import java.text.*;
* "The Java Language Specification", ISBN 0-201-63451-1,
* and O'Reilly's "Java in a Nutshell".
* Status: Need to re-write toString().
- * Missing: ToGMTString and toLocaleString.
- * Serialization spec: Specifies readObject/writeObject.
+ * Missing: ToGMTString.
*/
-
public class Date implements java.io.Serializable, Cloneable
{
- private long millis;
+ private static final long serialVersionUID = 7523967970034938905L;
+
+ transient private long millis;
public Date() { millis = System.currentTimeMillis(); }
@@ -480,4 +480,27 @@ public class Date implements java.io.Serializable, Cloneable
cal.set(year+1900, month, date, hours, minutes, seconds);
return cal.getTimeInMillis();
}
+
+ /**
+ * Reads an Object from the stream.
+ */
+ private void readObject (java.io.ObjectInputStream input)
+ throws java.io.IOException, ClassNotFoundException
+ {
+ input.defaultReadObject ();
+ millis = input.readLong ();
+ }
+
+ /**
+ * Writes an Object to the stream.
+ * @serialdata A long value representing the offset from the epoch
+ * in milliseconds. This is the same value that is returned by the
+ * method getTime().
+ */
+ private void writeObject (java.io.ObjectOutputStream output)
+ throws java.io.IOException
+ {
+ output.defaultWriteObject ();
+ output.writeLong (millis);
+ }
}