T
- the type of the object contained in this MarshalledObject
Serializable
public final class MarshalledObject<T> extends Object implements Serializable
MarshalledObject
contains a byte stream with the serialized representation of an object given to its constructor. The get
method returns a new copy of the original object, as deserialized from the contained byte stream. The contained object is serialized and deserialized with the same serialization semantics used for marshaling and unmarshaling parameters and return values of RMI calls: When the serialized form is created: MarshalledObject
is represented by a serialized instance of its stub. When copy of the object is retrieved (via the get
method), if the class is not available locally, it will be loaded from the appropriate location (specified the URL annotated with the class descriptor when the class was serialized.
MarshalledObject
facilitates passing objects in RMI calls that are not automatically deserialized immediately by the remote peer.
Constructor | Description |
---|---|
MarshalledObject |
Creates a new MarshalledObject that contains the serialized representation of the current state of the supplied object. |
public MarshalledObject(T obj) throws IOException
MarshalledObject
that contains the serialized representation of the current state of the supplied object. The object is serialized with the semantics used for marshaling parameters for RMI calls.obj
- the object to be serialized (must be serializable)IOException
- if an IOException
occurs; an IOException
may occur if obj
is not serializable.public T get() throws IOException, ClassNotFoundException
IOException
- if an IOException
occurs while deserializing the object from its internal representation.ClassNotFoundException
- if a ClassNotFoundException
occurs while deserializing the object from its internal representation. could not be foundpublic int hashCode()
MarshalledObject
.public boolean equals(Object obj)
MarshalledObject
to another object. Returns true if and only if the argument refers to a MarshalledObject
that contains exactly the same serialized representation of an object as this one does. The comparison ignores any class codebase annotation, meaning that two objects are equivalent if they have the same serialized representation except for the codebase of each class in the serialized representation.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.rmi/java/rmi/MarshalledObject.html