An extension of
ObjectInputStream
that implements the dynamic class loading
semantics of Java(TM) Remote Method Invocation (Java RMI) argument and result unmarshalling
(using
RMIClassLoader). A
MarshalInputStream
is intended to read data
written by a corresponding
MarshalOutputStream.
MarshalInputStream
implements the input side of the dynamic class loading
semantics by overriding
ObjectInputStream#resolveClass and
ObjectInputStream#resolveProxyClass to resolve class descriptors in the stream
using
ClassLoading#loadClass and
ClassLoading#loadProxyClass (which, in turn, use
RMIClassLoader#loadClass(String,String,ClassLoader) and
RMIClassLoader#loadProxyClass(String,String[],ClassLoader)),
optionally with codebase annotation strings written by a MarshalOutputStream
.
By default, a MarshalInputStream
ignores all codebase annotation strings, instead
using a codebase value of null
when loading classes. Codebase annotation strings
will only be used by a MarshalInputStream
after its
#useCodebaseAnnotations method has been invoked.
MarshalInputStream
supports optional verification that all codebase annotation
URLs that are used to load classes resolved by the stream provide content integrity (see
Security#verifyCodebaseIntegrity). Whether or not a particular
MarshalInputStream
instance verifies that codebase annotation URLs provide content
integrity is determined by the verifyCodebaseIntegrity
constructor argument. See
ClassLoading#loadClass and
ClassLoading#loadProxyClass for details of how codebase integrity verification is performed.
MarshalInputStream
reads class annotations from its own stream; a subclass can
override the
#readAnnotation method to read the class annotations from a
different location.
A MarshalInputStream
is not guaranteed to be safe for concurrent use by multiple
threads.