From f7ce7e1e7ea220277a849d860fa470f665b84a9c Mon Sep 17 00:00:00 2001 From: warrenl Date: Thu, 5 Oct 2000 23:57:16 +0000 Subject: * 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). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36736 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/java/util/Date.java | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'libjava/java/util') diff --git a/libjava/java/util/Date.java b/libjava/java/util/Date.java index 6a8a7654938..4b76b8ab6ef 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); + } } -- cgit v1.2.3