MarshalledObject
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.
| Modifier and Type | Class and Description |
|---|---|
| private static class | MarshalledObject.
The counterpart to |
| private static class | MarshalledObject.
This class is used to marshal objects for
|
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private byte[] | |
| private byte[] | |
| private transient ObjectInputFilter | objectInputFilter
Filter used when creating the instance from a stream; may be null. |
| private static final long | serialVersionUID
Indicate compatibility with 1.2 version of class. |
| Access | Constructor and Description |
|---|---|
| public | MarshalledObject(T
the object to be serialized (must be serializable) obj)Creates a new |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if the argument contains an equivalent
serialized object; false otherwisethe object to compare with this obj)MarshalledObjectOverrides java. Compares this |
| public T | |
| public int | Returns: a hash codeOverrides java. Return a hash code for this |
| private void | readObject(ObjectInputStream
the stream stream)Reads in the state of the object and saves the stream's serialization filter to be used when the object is deserialized. |
| hash | back to summary |
|---|---|
private int hash
| |
| locBytes | back to summary |
|---|---|
| private byte[] locBytes | |
| objBytes | back to summary |
|---|---|
| private byte[] objBytes | |
| objectInputFilter | back to summary |
|---|---|
| private transient ObjectInputFilter objectInputFilter Filter used when creating the instance from a stream; may be null. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Indicate compatibility with 1.2 version of class. | |
| MarshalledObject | back to summary |
|---|---|
| public MarshalledObject(T obj) throws IOException Creates a new
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Compares this
| |
| get | back to summary |
|---|---|
| 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 parameters for RMI calls. If the MarshalledObject was read from an ObjectInputStream, the filter from that stream is used to deserialize the object.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Return a hash code for this
| |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException Reads in the state of the object and saves the stream's serialization filter to be used when the object is deserialized.
| |
MarshalledObjectOutputStream.
MarshalledObjectOutputStream
| Modifier and Type | Field and Description |
|---|---|
| private ObjectInputStream | locIn
The stream from which annotations will be read. |
| Access | Constructor and Description |
|---|---|
| pack-priv | MarshalledObjectInputStream(InputStream objIn, InputStream locIn, ObjectInputFilter filter)
Creates a new |
| Modifier and Type | Method and Description |
|---|---|
| protected Object | readLocation()
Overrides sun. Overrides MarshalInputStream.readLocation to return locations from
the stream we were given, or |
| locIn | back to summary |
|---|---|
| private ObjectInputStream locIn The stream from which annotations will be read. If this is
| |
| MarshalledObjectInputStream | back to summary |
|---|---|
| pack-priv MarshalledObjectInputStream(InputStream objIn, InputStream locIn, ObjectInputFilter filter) throws IOException Creates a new | |
| readLocation | back to summary |
|---|---|
| protected Object readLocation() throws IOException, ClassNotFoundException Overrides sun. Overrides MarshalInputStream.readLocation to return locations from
the stream we were given, or | |
MarshalledObject. It places the location annotations
to one side so that two MarshalledObjects can be
compared for equality if they differ only in location
annotations. Objects written using this stream should be read back
from a MarshalledObjectInputStream.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | hadAnnotations
|
| private ObjectOutputStream | locOut
The stream on which location objects are written. |
| Access | Constructor and Description |
|---|---|
| pack-priv | MarshalledObjectOutputStream(OutputStream objOut, OutputStream locOut)
Creates a new |
| Modifier and Type | Method and Description |
|---|---|
| public void | flush()
Overrides java. Implements java. Flushes the stream. |
| pack-priv boolean | |
| protected void | writeLocation(String loc)
Overrides sun. Overrides MarshalOutputStream.writeLocation implementation to write annotations to the location stream. |
| hadAnnotations | back to summary |
|---|---|
| private boolean hadAnnotations
| |
| locOut | back to summary |
|---|---|
| private ObjectOutputStream locOut The stream on which location objects are written. | |
| MarshalledObjectOutputStream | back to summary |
|---|---|
| pack-priv MarshalledObjectOutputStream(OutputStream objOut, OutputStream locOut) throws IOException Creates a new | |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Overrides java. Implements java. Doc from java. Flushes the stream. This will write any buffered output bytes and flush through to the underlying stream.
| |
| hadAnnotations | back to summary |
|---|---|
| pack-priv boolean hadAnnotations() Returns | |
| writeLocation | back to summary |
|---|---|
| protected void writeLocation(String loc) throws IOException Overrides sun. Overrides MarshalOutputStream.writeLocation implementation to write annotations to the location stream. | |