org.apache.commons.io.input

Class ClassLoaderObjectInputStream

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

Field Summary
ClassLoaderclassLoader
The class loader to use.
Constructor Summary
ClassLoaderObjectInputStream(ClassLoader classLoader, InputStream inputStream)
Constructs a new ClassLoaderObjectInputStream.
Method Summary
protected ClassresolveClass(ObjectStreamClass objectStreamClass)
Resolve a class specified by the descriptor using the specified ClassLoader or the super ClassLoader.

Field Detail

classLoader

private ClassLoader classLoader
The class loader to use.

Constructor Detail

ClassLoaderObjectInputStream

public ClassLoaderObjectInputStream(ClassLoader classLoader, InputStream inputStream)
Constructs a new ClassLoaderObjectInputStream.

Parameters: classLoader the ClassLoader from which classes should be loaded inputStream the InputStream to work on

Throws: IOException in case of an I/O error StreamCorruptedException if the stream is corrupted

Method Detail

resolveClass

protected Class resolveClass(ObjectStreamClass objectStreamClass)
Resolve a class specified by the descriptor using the specified ClassLoader or the super ClassLoader.

Parameters: objectStreamClass descriptor of the class

Returns: the Class object described by the ObjectStreamClass

Throws: IOException in case of an I/O error ClassNotFoundException if the Class cannot be found

Copyright (c) 2002-2011 Apache Software Foundation