org.apache.commons.io.input
Class ClassLoaderObjectInputStream
java.lang.Object
|
+--java.io.InputStream
|
+--java.io.ObjectInputStream
|
+--org.apache.commons.io.input.ClassLoaderObjectInputStream
- All Implemented Interfaces:
- DataInput, ObjectInput, ObjectStreamConstants
- public class ClassLoaderObjectInputStream
- extends ObjectInputStream
A special ObjectInputStream that loads a class based on a specified
ClassLoader
rather than the system default.
This is useful in dynamic container environments.
- Since:
- Commons IO 1.1
- Version:
- $Id: ClassLoaderObjectInputStream.java 437567 2006-08-28 06:39:07Z bayard $
- Author:
- Paul Hammant
Fields inherited from class java.io.ObjectInputStream |
abortClassNotFoundException, abortIOException, blockDataMode, buf, bufpos, bufsize, callbacks, cdata, CDATA_MAX_LEN, classdesc, classes, count, currCode, currentClass, currentClassDesc, currentGetFields, currentObject, data, dis, enableResolve, enableSubclassImplementation, in, nextWireOffset, readObjectArglist, recursionDepth, sbuf, spClass, wireHandle2Object |
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 |
Method Summary |
protected Class |
resolveClass(ObjectStreamClass objectStreamClass)
Resolve a class specified by the descriptor using the
specified ClassLoader or the super ClassLoader. |
Methods inherited from class java.io.ObjectInputStream |
allocateNewArray, allocateNewObject, assignWireOffset, available, bufferData, bytesToDoubles, bytesToFloats, close, defaultReadObject, doValidations, enableResolveObject, ensureBufferCapacity, growClassStacks, inputArray, inputClassDescriptor, inputClassFields, inputObject, inputProxyClassDescriptor, invokeObjectReader, latestUserDefinedLoader, loadClass0, peekCode, pushbackCode, read, read, readBoolean, readByte, readChar, readClassDescriptor, readCode, readDouble, readFields, readFloat, readFully, readFully, readFullyInternal, readInt, readLine, readLong, readObject, readObject, readObjectOverride, readShort, readStreamHeader, readUnsignedByte, readUnsignedShort, readUTF, readUTFBody, refill, registerValidation, resetStream, resolveObject, resolveProxyClass, setBlockData, setObjectFieldValue, setPrimitiveFieldValues, skipBytes, skipToEndOfBlockData |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
classLoader
private ClassLoader classLoader
- The class loader to use.
ClassLoaderObjectInputStream
public ClassLoaderObjectInputStream(ClassLoader classLoader,
InputStream inputStream)
throws IOException,
StreamCorruptedException
- Constructs a new ClassLoaderObjectInputStream.
- Parameters:
classLoader
- the ClassLoader from which classes should be loadedinputStream
- the InputStream to work on- Throws:
IOException
- in case of an I/O errorStreamCorruptedException
- if the stream is corrupted
resolveClass
protected Class resolveClass(ObjectStreamClass objectStreamClass)
throws IOException,
ClassNotFoundException
- Resolve a class specified by the descriptor using the
specified ClassLoader or the super ClassLoader.
- Overrides:
resolveClass
in class ObjectInputStream
- Parameters:
objectStreamClass
- descriptor of the class- Returns:
- the Class object described by the ObjectStreamClass
- Throws:
IOException
- in case of an I/O errorClassNotFoundException
- if the Class cannot be found