- Type Parameters:
T- the type of the object contained in this
- All Implemented Interfaces:
public final class MarshalledObject<T> extends Object implements SerializableA
MarshalledObjectcontains a byte stream with the serialized representation of an object given to its constructor. The
getmethod 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:
- classes are annotated with a codebase URL from where the class can be loaded (if available), and
- any remote object in the
MarshalledObjectis represented by a serialized instance of its stub.
When copy of the object is retrieved (via the
getmethod), 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.
MarshalledObjectfacilitates passing objects in RMI calls that are not automatically deserialized immediately by the remote peer.
- See Also:
- Serialized Form
All Methods Instance Methods Concrete Methods Modifier and Type Method Description
equals(Object obj)Compares this
MarshalledObjectto another object.
get()Returns a new copy of the contained marshalledobject.
hashCode()Return a hash code for this
public MarshalledObject(T obj) throws IOExceptionCreates a new
MarshalledObjectthat 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
IOExceptionmay occur if
objis not serializable.
public T get() throws IOException, ClassNotFoundExceptionReturns a new copy of the contained marshalledobject. The internal representation is deserialized with the semantics used for unmarshaling parameters for RMI calls. If the MarshalledObject was read from an ObjectInputStream, the filter from that stream is used to deserialize the object.
- a copy of the contained object
IOException- if an
IOExceptionoccurs while deserializing the object from its internal representation.
ClassNotFoundException- if a
ClassNotFoundExceptionoccurs while deserializing the object from its internal representation. could not be found
public int hashCode()Return a hash code for this
public boolean equals(Object obj)Compares this
MarshalledObjectto another object. Returns true if and only if the argument refers to a
MarshalledObjectthat 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.