Provides I/O interfaces and utility classes.

See: Description

Package Description

Provides I/O interfaces and utility classes.


The interface ObjectStreamContext may be implemented by an object serialization stream class (a subclass of ObjectOutputStream or 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 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 ClientHost and ClientSubject.

MarshalOutputStream and MarshalInputStream

The classes MarshalOutputStream and MarshalInputStream extend the object serialization stream classes ObjectOutputStream and ObjectInputStream to implement the dynamic class loading semantics of RMI argument and result marshalling and unmarshalling. MarshalOutputStream and MarshalInputStream use RMIClassLoader to get class annotations for marshalling and to resolve codebase annotations to Class objects for unmarshalling. MarshalInputStream supports optional verification that the codebase annotation URLs used to resolve classes provide content integrity (see 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.


A 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 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.