Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.remoting.loading
Class ObjectInputStreamWithClassLoader

    java.lang.Object
      java.io.InputStream
          java.io.ObjectInputStream
              org.jboss.remoting.loading.ObjectInputStreamWithClassLoader

All Implemented Interfaces:
  DataInput, ObjectInput, ObjectStreamConstants

public class ObjectInputStreamWithClassLoader
extends ObjectInputStream

ObjectInputStreamWithClassLoader

Version:
  $Revision: 1.1 $
Author:
  Jeff Haynie

Nested Class Summary

Nested classes inherited from class java.io.ObjectInputStream
`ObjectInputStream.GetField`

Field Summary

Fields inherited from interface java.io.ObjectStreamConstants
`baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, STREAM_MAGIC, STREAM_VERSION, SUBCLASS_IMPLEMENTATION_PERMISSION, SUBSTITUTION_PERMISSION, TC_ARRAY, TC_BASE, TC_BLOCKDATA, TC_BLOCKDATALONG, TC_CLASS, TC_CLASSDESC, TC_ENDBLOCKDATA, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING`

Constructor Summary
`ObjectInputStreamWithClassLoader(InputStream in, ClassLoader cl)` Create an ObjectInputStream that reads from the specified InputStream.

Method Summary
`protected Class` | `resolveClass(ObjectStreamClass v)` Load the local class equivalent of the specified stream class description.
`protected Class` | `resolveProxyClass(String[] interfaces)` Returns a proxy class that implements the interfaces named in a proxy class descriptor; subclasses may implement this method to read custom data from the stream along with the descriptors for dynamic proxy classes, allowing them to use an alternate loading mechanism for the interfaces and the proxy class.

Methods inherited from class java.io.ObjectInputStream
`available, close, defaultReadObject, enableResolveObject, read, read, readBoolean, readByte, readChar, readClassDescriptor, readDouble, readFields, readFloat, readFully, readFully, readInt, readLine, readLong, readObject, readObjectOverride, readShort, readStreamHeader, readUnshared, readUnsignedByte, readUnsignedShort, readUTF, registerValidation, resolveObject, skipBytes`

Methods inherited from class java.io.InputStream
`mark, markSupported, read, reset, skip`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface java.io.ObjectInput
`read, skip`

Constructor Detail

### ObjectInputStreamWithClassLoader

    public ObjectInputStreamWithClassLoader(InputStream in,
                                            ClassLoader cl)
                                     throws IOException,
                                            StreamCorruptedException

  Create an ObjectInputStream that reads from the specified InputStream. The stream header containing the magic number and version number are read from the stream and verified. This method will block until the corresponding ObjectOutputStream has written and flushed the header.

Parameters:
  `in` - the underlying `InputStream` from which to read
Throws:
  `StreamCorruptedException` - The version or magic number are incorrect.
  `IOException` - An exception occurred in the underlying stream.

Method Detail

### resolveClass

    protected Class resolveClass(ObjectStreamClass v)
                          throws IOException,
                                 ClassNotFoundException

  Load the local class equivalent of the specified stream class description. Subclasses may implement this method to allow classes to be fetched from an alternate source. The corresponding method in ObjectOutputStream is annotateClass. This method will be invoked only once for each unique class in the stream. This method can be implemented by subclasses to use an alternate loading mechanism but must return a Class object. Once returned, the serialVersionUID of the class is compared to the serialVersionUID of the serialized class. If there is a mismatch, the deserialization fails and an exception is raised.

  By default the class name is resolved relative to the class that called readObject.

  Parameters:
    `v` - an instance of class ObjectStreamClass
  Returns:
    a Class object corresponding to `v`
  Throws:
    `IOException` - Any of the usual Input/Output exceptions.
    `ClassNotFoundException` - If class of a serialized object cannot be found.

### resolveProxyClass

    protected Class resolveProxyClass(String[] interfaces)
                               throws IOException,
                                      ClassNotFoundException

  Returns a proxy class that implements the interfaces named in a proxy class descriptor; subclasses may implement this method to read custom data from the stream along with the descriptors for dynamic proxy classes, allowing them to use an alternate loading mechanism for the interfaces and the proxy class.

  This method is called exactly once for each unique proxy class descriptor in the stream.

  The corresponding method in `ObjectOutputStream` is `annotateProxyClass`. For a given subclass of `ObjectInputStream` that overrides this method, the `annotateProxyClass` method in the corresponding subclass of `ObjectOutputStream` must write any data or objects read by this method.

  The default implementation of this method in `ObjectInputStream` returns the result of calling `Proxy.getProxyClass` with the list of `Class` objects for the interfaces that are named in the `interfaces` parameter. The `Class` object for each interface name `i` is the value returned by calling

           Class.forName(i, false, loader)

  where `loader` is that of the first non-null class loader up the execution stack, or `null` if no non-null class loaders are on the stack (the same class loader choice used by the `resolveClass` method). This same value of `loader` is also the class loader passed to `Proxy.getProxyClass`. If `Proxy.getProxyClass` throws an `IllegalArgumentException`, `resolveProxyClass` will throw a `ClassNotFoundException` containing the `IllegalArgumentException`.

  Parameters:
    `interfaces` - the list of interface names that were deserialized in the proxy class descriptor
  Returns:
    a proxy class for the specified interfaces
  Throws:
    `IOException` - any exception thrown by the underlying `InputStream`
    `ClassNotFoundException` - if the proxy class or any of the named interfaces could not be found
  Since:
    1.3
  See Also:
    `ObjectOutputStream.annotateProxyClass(java.lang.Class)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.