- java.lang.Object
-
- java.rmi.MarshalledObject<T>
-
- Type Parameters:
T
- the type of the object contained in thisMarshalledObject
- All Implemented Interfaces:
- Serializable
public final class MarshalledObject<T> extends Object implements Serializable
AMarshalledObject
contains a byte stream with the serialized representation of an object given to its constructor. Theget
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:- classes are annotated with a codebase URL from where the class can be loaded (if available), and
- any remote object in the
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.- Since:
- 1.2
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description MarshalledObject(T obj)
Creates a newMarshalledObject
that contains the serialized representation of the current state of the supplied object.
-
-
-
Constructor Detail
-
MarshalledObject
public MarshalledObject(T obj) throws IOException
Creates a newMarshalledObject
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.- Parameters:
obj
- the object to be serialized (must be serializable)- Throws:
IOException
- if anIOException
occurs; anIOException
may occur ifobj
is not serializable.- Since:
- 1.2
-
-
Method Detail
-
get
public T get() throws IOException, ClassNotFoundException
Returns a new copy of the contained marshalledobject. The internal representation is deserialized with the semantics used for unmarshaling paramters for RMI calls.- Returns:
- a copy of the contained object
- Throws:
IOException
- if anIOException
occurs while deserializing the object from its internal representation.ClassNotFoundException
- if aClassNotFoundException
occurs while deserializing the object from its internal representation. could not be found- Since:
- 1.2
-
hashCode
public int hashCode()
Return a hash code for thisMarshalledObject
.- Overrides:
hashCode
in classObject
- Returns:
- a hash code
- See Also:
Object.equals(java.lang.Object)
,System.identityHashCode(java.lang.Object)
-
equals
public boolean equals(Object obj)
Compares thisMarshalledObject
to another object. Returns true if and only if the argument refers to aMarshalledObject
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.- Overrides:
equals
in classObject
- Parameters:
obj
- the object to compare with thisMarshalledObject
- Returns:
true
if the argument contains an equaivalent serialized object;false
otherwise- Since:
- 1.2
- See Also:
Object.hashCode()
,HashMap
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
22/12/2024 20:26:22 Cette version de la page est en cache (à la date du 22/12/2024 20:26:22) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 29/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-java/rmi/marshalledobject.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.