ObjectStreamContext
The interface {@link net.jini.io.ObjectStreamContext} may be
implemented by an object serialization stream class (a subclass of
{@link java.io.ObjectOutputStream} or {@link
java.io.ObjectInputStream}) to provide each object being serialized or
deserialized with access to context information relevant to the
overall serialization or deserialization operation. The class of an
object that is being serialized or deserialized can test (in its
private writeObject(ObjectOutputStream)
or
readObject(ObjectInputStream)
method) if the object
stream being used is an instance of ObjectStreamContext
.
If the stream class does implement that interface, the class can then
retrieve the context information (as a {@link java.util.Collection
Collection} of context objects) by invoking the stream's
getObjectStreamContext
method. The context information
available from a given element of the collection is determined by that
element's type. Examples of types that a context object might
implement include {@link net.jini.io.context.ClientHost} and {@link
net.jini.io.context.ClientSubject}.
MarshalOutputStream
and MarshalInputStream
The classes {@link net.jini.io.MarshalOutputStream} and {@link
net.jini.io.MarshalInputStream} extend the object serialization stream
classes {@link java.io.ObjectOutputStream} and {@link
java.io.ObjectInputStream} to implement the dynamic class loading
semantics of RMI argument and result marshalling and unmarshalling.
MarshalOutputStream
and MarshalInputStream
use {@link java.rmi.server.RMIClassLoader} to get class annotations
for marshalling and to resolve codebase annotations to {@link
java.lang.Class} objects for unmarshalling.
MarshalInputStream
supports optional verification that
the codebase annotation URLs used to resolve classes provide content
integrity (see {@link
net.jini.security.Security#verifyCodebaseIntegrity
Security.verifyCodebaseIntegrity}). MarshalOutputStream
and MarshalInputStream
may be extended (in concert) to
communicate class annotations in a way other than in the streams' own
data. Both MarshalOutputStream
and
MarshalInputStream
implement
ObjectStreamContext
.
MarshalledInstance
A {@link net.jini.io.MarshalledInstance} contains an object in
serialized form. A MarshalledInstance
can be
unmarshalled on demand, allowing an object to be sent in such a way
that the receiver can control when and in what context the object is
unmarshalled. MarshalledInstance
provides functionality
similar to {@link java.rmi.MarshalledObject}, but it additionally
supports use of object stream contexts and optional verification that
the codebase annotation URLs used to resolve classes provide content
integrity. A convenience constructor and method are provided for
converting between MarshalledObject
and
MarshalledInstance
instances.
@since 2.0
@version 2.0