APIdia Launch Partner
Top Description Fields Constructors Methods
sun.rmi.server

public Class MarshalInputStream

extends ObjectInputStream
Class Inheritance
Known Direct Subclasses
sun.rmi.transport.ConnectionInputStream, java.rmi.MarshalledObject.MarshalledObjectInputStream
Imports
java.io.IOException, .InputStream, .ObjectInputStream, .ObjectStreamClass, .StreamCorruptedException, java.util.*, java.security.AccessControlException, .Permission, java.rmi.server.RMIClassLoader

MarshalInputStream is an extension of ObjectInputStream. When resolving a class, it reads an object from the stream written by a corresponding MarshalOutputStream. If the class to be resolved is not available locally, from the first class loader on the execution stack, or from the context class loader of the current thread, it will attempt to load the class from the location annotated by the sending MarshalOutputStream. This location object must be a string representing a path of URLs. A new MarshalInputStream should be created to deserialize remote objects or graphs containing remote objects. Objects are created from the stream using the ObjectInputStream.readObject method.
Author
Peter Jones

Field Summary

Modifier and TypeField and Description
private final Map<Object, Runnable>
doneCallbacks

callbacks to make when done() called: maps Object to Runnable

protected static Map<String, Class<?>>
permittedSunClasses

table to hold sun classes to which access is explicitly permitted

private boolean
skipDefaultResolveClass

if true, don't try superclass first in resolveClass()

private boolean
useCodebaseOnly

if true, load classes (if not available locally) only from the URL specified by the "java.rmi.server.codebase" property.

private static final boolean
useCodebaseOnlyProperty

Value of "java.rmi.server.useCodebaseOnly" property, as cached at class initialization time.

Constructor Summary

AccessConstructor and Description
public
MarshalInputStream(InputStream in)

Create a new MarshalInputStream object.

Method Summary

Modifier and TypeMethod and Description
private Class<?>
checkSunClass(String className, AccessControlException e)
References Deprecated AccessControlException is deprecated or references (maybe indirectly) at least one deprecated element.

Fix for 4179055: Need to assist resolving sun stubs; resolve class locally if it is a "permitted" sun class

public void
close()

Overrides java.io.ObjectInputStream.close.

Implements java.io.ObjectInput.close, java.io.Closeable.close.

Closes this stream, implicitly invoking done() first.

public void
done()

Indicates that the user of this MarshalInputStream is done reading objects from it, so all callbacks registered with the setDoneCallback method should now be (synchronously) executed.

public Runnable
getDoneCallback(Object key)

Returns a callback previously registered via the setDoneCallback method with given key, or null if no callback has yet been registered with that key.

private static ClassLoader
latestUserDefinedLoader()

Hides java.io.ObjectInputStream.latestUserDefinedLoader.

Returns the first non-null and non-platform class loader (not counting class loaders of generated reflection implementation classes) up the execution stack, or the platform class loader if only code from the bootstrap and platform class loader is on the stack.

protected Object
readLocation()

Return the location for the class in the stream.

protected Class<?>
resolveClass(ObjectStreamClass classDesc)

Overrides java.io.ObjectInputStream.resolveClass.

resolveClass is extended to acquire (if present) the location from which to load the specified class.

protected Class<?>
resolveProxyClass(String[] interfaces)

Overrides java.io.ObjectInputStream.resolveProxyClass.

resolveProxyClass is extended to acquire (if present) the location to determine the class loader to define the proxy class in.

public void
setDoneCallback(Object key, Runnable callback)

Registers a callback to make when this stream's done() method is invoked, along with a key for retrieving the same callback instance subsequently from the getDoneCallback method.

pack-priv void
skipDefaultResolveClass()

Set a flag to indicate that the superclass's default resolveClass() implementation should not be invoked by our resolveClass().

pack-priv void
useCodebaseOnly()

Disable code downloading except from the URL specified by the "java.rmi.server.codebase" property.

Inherited from java.io.ObjectInputStream:
availabledefaultReadObjectenableResolveObjectgetObjectInputFilterreadreadreadBooleanreadBytereadCharreadClassDescriptorreadDoublereadFieldsreadFloatreadFullyreadFullyreadIntreadLinereadLongreadObjectreadObjectOverridereadShortreadStreamHeaderreadUnsharedreadUnsignedBytereadUnsignedShortreadUTFregisterValidationresolveObjectsetObjectInputFilterskipBytes

Field Detail

doneCallbacksback to summary
private final Map<Object, Runnable> doneCallbacks

callbacks to make when done() called: maps Object to Runnable

permittedSunClassesback to summary
protected static Map<String, Class<?>> permittedSunClasses

table to hold sun classes to which access is explicitly permitted

skipDefaultResolveClassback to summary
private boolean skipDefaultResolveClass

if true, don't try superclass first in resolveClass()

useCodebaseOnlyback to summary
private boolean useCodebaseOnly

if true, load classes (if not available locally) only from the URL specified by the "java.rmi.server.codebase" property.

useCodebaseOnlyPropertyback to summary
private static final boolean useCodebaseOnlyProperty

Value of "java.rmi.server.useCodebaseOnly" property, as cached at class initialization time. The default value is true. That is, the value is true if the property is absent or is not equal to "false". The value is only false when the property is present and is equal to "false".

Constructor Detail

MarshalInputStreamback to summary
public MarshalInputStream(InputStream in) throws IOException, StreamCorruptedException

Create a new MarshalInputStream object.

Method Detail

checkSunClassback to summary
private Class<?> checkSunClass(String className, AccessControlException e) throws AccessControlException

References Deprecated

AccessControlException is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Fix for 4179055: Need to assist resolving sun stubs; resolve class locally if it is a "permitted" sun class

Annotations
@SuppressWarnings:removal
closeback to summary
public void close() throws IOException

Overrides java.io.ObjectInputStream.close.

Implements java.io.ObjectInput.close, java.io.Closeable.close.

Closes this stream, implicitly invoking done() first.

Exceptions
IOException:

Doc from java.io.ObjectInputStream.close.

If an I/O error has occurred.

doneback to summary
public void done()

Indicates that the user of this MarshalInputStream is done reading objects from it, so all callbacks registered with the setDoneCallback method should now be (synchronously) executed. When this method returns, there are no more callbacks registered. This method is implicitly invoked by close() before it delegates to the superclass's close method.

getDoneCallbackback to summary
public Runnable getDoneCallback(Object key)

Returns a callback previously registered via the setDoneCallback method with given key, or null if no callback has yet been registered with that key.

latestUserDefinedLoaderback to summary
private static ClassLoader latestUserDefinedLoader()

Hides java.io.ObjectInputStream.latestUserDefinedLoader.

Doc from java.io.ObjectInputStream.latestUserDefinedLoader.

Returns the first non-null and non-platform class loader (not counting class loaders of generated reflection implementation classes) up the execution stack, or the platform class loader if only code from the bootstrap and platform class loader is on the stack.

readLocationback to summary
protected Object readLocation() throws IOException, ClassNotFoundException

Return the location for the class in the stream. This method can be overridden by subclasses that store this annotation somewhere else than as the next object in the stream, as is done by this class.

resolveClassback to summary
protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException

Overrides java.io.ObjectInputStream.resolveClass.

resolveClass is extended to acquire (if present) the location from which to load the specified class. It will find, load, and return the class.

Exceptions
IOException:

Doc from java.io.ObjectInputStream.resolveClass.

any of the usual Input/Output exceptions.

ClassNotFoundException:

Doc from java.io.ObjectInputStream.resolveClass.

if class of a serialized object cannot be found.

resolveProxyClassback to summary
protected Class<?> resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException

Overrides java.io.ObjectInputStream.resolveProxyClass.

resolveProxyClass is extended to acquire (if present) the location to determine the class loader to define the proxy class in.

Exceptions
IOException:

Doc from java.io.ObjectInputStream.resolveProxyClass.

any exception thrown by the underlying InputStream

ClassNotFoundException:

Doc from java.io.ObjectInputStream.resolveProxyClass.

if the proxy class or any of the named interfaces could not be found

setDoneCallbackback to summary
public void setDoneCallback(Object key, Runnable callback)

Registers a callback to make when this stream's done() method is invoked, along with a key for retrieving the same callback instance subsequently from the getDoneCallback method.

skipDefaultResolveClassback to summary
pack-priv void skipDefaultResolveClass()

Set a flag to indicate that the superclass's default resolveClass() implementation should not be invoked by our resolveClass().

useCodebaseOnlyback to summary
pack-priv void useCodebaseOnly()

Disable code downloading except from the URL specified by the "java.rmi.server.codebase" property.