Agent System POND 1.2 (28.2.2002)

FIM.Util
Class ClassLoaderObjectInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--java.io.ObjectInputStream
              |
              +--FIM.Util.ClassLoaderObjectInputStream
All Implemented Interfaces:
DataInput, ObjectInput, ObjectStreamConstants

public class ClassLoaderObjectInputStream
extends ObjectInputStream

A stream defining the classes which are deserialized not through the standard classloader but a classloader specified by the user.

Version:
1.0, 1.7.2000
Author:
Michael Sonntag

Inner classes inherited from class java.io.ObjectInputStream
ObjectInputStream.GetField, ObjectInputStream.GetFieldImpl
 
Fields inherited from class java.io.ObjectInputStream
classdesc, classes, enableResolve, spClass
 
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
ClassLoaderObjectInputStream(InputStream in)
          Create an ClassLoaderObjectInputStream that reads from the specified InputStream.
 
Method Summary
 ClassLoader getClassLoader()
          Returns the classloader used for laoding the classes in this stream.
 Class resolveClass(ObjectStreamClass v)
          Load the local class equivalent of the specified stream class description.
 void setClassLoader(ClassLoader classLoader)
          Sets the classloader through which to load the classes.
 
Methods inherited from class java.io.ObjectInputStream
available, bufferData, close, defaultReadObject, enableResolveObject, read, read, readBoolean, readByte, readChar, readClassDescriptor, readDouble, readFields, readFloat, readFully, readFully, readInt, readLine, readLong, readObject, readObjectOverride, readShort, readStreamHeader, readUnsignedByte, readUnsignedShort, readUTF, registerValidation, resolveObject, resolveProxyClass, 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
 
Methods inherited from interface java.io.ObjectStreamConstants
 

Constructor Detail

ClassLoaderObjectInputStream

public ClassLoaderObjectInputStream(InputStream in)
                             throws IOException,
                                    StreamCorruptedException
Create an ClassLoaderObjectInputStream that reads from the specified InputStream.
Parameters:
in - the underlying InputStream
Throws:
StreamCorruptedException - if the version or magic number are incorrect.
IOException - if an exception occurred in the underlying stream.
Method Detail

setClassLoader

public final void setClassLoader(ClassLoader classLoader)
Sets the classloader through which to load the classes.
Parameters:
classLoader - the classloader to use when creating objects

getClassLoader

public final ClassLoader getClassLoader()
Returns the classloader used for laoding the classes in this stream. Necessary for SignedMessage; it must load the contained class through the classloader it loads itself
Throws:
SecurityException - if the caller has no permission to access a classloader (RuntimePermission("getClassLoader"))
See Also:
SignedMessage

resolveClass

public Class resolveClass(ObjectStreamClass v)
                   throws IOException,
                          ClassNotFoundException
Load the local class equivalent of the specified stream class description. This method will be invoked only once for each unique class in the stream. 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.

Overrides:
resolveClass in class ObjectInputStream
Parameters:
v - The definition of the class to resolve (serialized information)
Throws:
ClassNotFoundException - If the class of a serialized object cannot be found.

Agent System POND 1.2 (28.2.2002)

Submit a bug

Copyright 2001,2002 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.