|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.ObjectInputStream
org.jboss.remoting.loading.ObjectInputStreamWithClassLoader
public class ObjectInputStreamWithClassLoader
ObjectInputStreamWithClassLoader
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.io.ObjectInputStream |
---|
java.io.ObjectInputStream.GetField |
Field Summary | |
---|---|
protected static java.lang.reflect.Method |
clearMethod
|
protected static org.jboss.logging.Logger |
log
|
Fields inherited from interface java.io.ObjectStreamConstants |
---|
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_ENUM, 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_ENUM, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING |
Constructor Summary | |
---|---|
ObjectInputStreamWithClassLoader(java.io.InputStream in,
java.lang.ClassLoader cl)
Create an ObjectInputStream that reads from the specified InputStream. |
Method Summary | |
---|---|
void |
clearCache()
|
java.lang.ClassLoader |
getClassLoader()
Gets the pluggable classloader that will be used for classloading when deserializing objects. |
protected java.lang.Class |
resolveClass(java.io.ObjectStreamClass v)
Load the local class equivalent of the specified stream class description. |
protected java.lang.Class |
resolveProxyClass(java.lang.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. |
void |
setClassLoader(java.lang.ClassLoader cl)
Set the classloader that the stream will used when deserializing 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 |
Field Detail |
---|
protected static java.lang.reflect.Method clearMethod
protected static final org.jboss.logging.Logger log
Constructor Detail |
---|
public ObjectInputStreamWithClassLoader(java.io.InputStream in, java.lang.ClassLoader cl) throws java.io.IOException, java.io.StreamCorruptedException
in
- the underlying InputStream
from which to read
java.io.StreamCorruptedException
- The version or magic number are
incorrect.
java.io.IOException
- An exception occurred in the underlying stream.Method Detail |
---|
public void setClassLoader(java.lang.ClassLoader cl)
cl
- public java.lang.ClassLoader getClassLoader()
public void clearCache()
protected java.lang.Class resolveClass(java.io.ObjectStreamClass v) throws java.io.IOException, java.lang.ClassNotFoundException
By default the class name is resolved relative to the class that called readObject.
Will use the classloader explicitly set if it exists. If it does not exist, will used its default classloader (that loader this instance).
resolveClass
in class java.io.ObjectInputStream
v
- an instance of class ObjectStreamClass
v
java.io.IOException
- Any of the usual Input/Output exceptions.
java.lang.ClassNotFoundException
- If class of
a serialized object cannot be found.protected java.lang.Class resolveProxyClass(java.lang.String[] interfaces) throws java.io.IOException, java.lang.ClassNotFoundException
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
.
resolveProxyClass
in class java.io.ObjectInputStream
interfaces
- the list of interface names that were
deserialized in the proxy class descriptor
java.io.IOException
- any exception thrown by the underlying
InputStream
java.lang.ClassNotFoundException
- if the proxy class or any of the
named interfaces could not be foundObjectOutputStream.annotateProxyClass(java.lang.Class)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |