diff options
author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-14 11:54:38 +0000 |
---|---|---|
committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-14 11:54:38 +0000 |
commit | 43462c2a6a58f16fa5138fe39fc6b0b22129c865 (patch) | |
tree | 43d8921b8292c787208a61bc7776888adfb3900e /libjava/java/io/ObjectStreamClass.java | |
parent | 20a69fd5230f450913720bbc8c5924e5f8e433a3 (diff) | |
download | ppe42-gcc-43462c2a6a58f16fa5138fe39fc6b0b22129c865.tar.gz ppe42-gcc-43462c2a6a58f16fa5138fe39fc6b0b22129c865.zip |
2003-02-14 Jeroen Frijters <jeroen@sumatra.nl>
* java/io/ObjectInputStream.java (readObject): Cleaned up the class
hierarchy loop.
(readFields(Object,ObjectStreamField[],boolean)): Changed argument
list to Object,ObjectStreamClass, moved callReadMethod code up into
readObject and added Class argument to all setXxxField calls.
(callReadMethod): Changed Class argument to ObjectStreamClass to be
consistent with ObjectOutputStream and to facilitate caching the
Method in the future.
(setBooleanField): Added Class argument.
(setByteField): Likewise.
(setCharField): Likewise.
(setDoubleField): Likewise.
(setFloatField): Likewise.
(setIntField): Likewise.
(setLongField): Likewise.
(setShortField): Likewise.
(setObjectField): Likewise.
* java/io/ObjectOutputStream.java (writeObject): Cleaned up the
class hierarchy loop.
(defaultWriteObject): Call writeFields with new argument list.
(writeFields(Object,ObjectStreamField[],boolean): Changed argument
list to Object,ObjectStreamClass, moved callWriteMethod up into
writeObject and added Class argument to all getXxxField calls.
(callWriteMethod): Added ObjectStreamClass argument to be able to
get the proper class to call getMethod on (each class can have (or
not have) its own writeObject method).
(getBooleanField): Added Class argument.
(getByteField): Likewise.
(getCharField): Likewise.
(getDoubleField): Likewise.
(getFloatField): Likewise.
(getIntField): Likewise.
(getLongField): Likewise.
(getShortField): Likewise.
(getObjectField): Likewise.
* java/io/ObjectStreamClass.java (hasReadMethod): Added method to
facilitate caching the Method object in the future.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64351 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/io/ObjectStreamClass.java')
-rw-r--r-- | libjava/java/io/ObjectStreamClass.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libjava/java/io/ObjectStreamClass.java b/libjava/java/io/ObjectStreamClass.java index 2111635525a..19a69ec47bc 100644 --- a/libjava/java/io/ObjectStreamClass.java +++ b/libjava/java/io/ObjectStreamClass.java @@ -194,6 +194,28 @@ public class ObjectStreamClass implements Serializable // Returns true iff the class that this ObjectStreamClass represents + // has the following method: + // + // private void readObject (ObjectOutputStream) + // + // This method is used by the class to override default + // serialization behavior. + boolean hasReadMethod () + { + try + { + Class[] readObjectParams = { ObjectInputStream.class }; + forClass ().getDeclaredMethod ("readObject", readObjectParams); + return true; + } + catch (NoSuchMethodException e) + { + return false; + } + } + + + // Returns true iff the class that this ObjectStreamClass represents // implements Serializable but does *not* implement Externalizable. boolean isSerializable () { |