javassist

Class LoaderClassPath

public class LoaderClassPath extends Object implements ClassPath

A class search-path representing a class loader.

It is used for obtaining a class file from the given class loader by getResourceAsStream(). The LoaderClassPath refers to the class loader through WeakReference. If the class loader is garbage collected, the other search pathes are examined.

The given class loader must have both getResourceAsStream() and getResource().

Author: Bill Burke Shigeru Chiba

See Also: insertClassPath appendClassPath ClassClassPath

Constructor Summary
LoaderClassPath(ClassLoader cl)
Creates a search path representing a class loader.
Method Summary
voidclose()
Closes this class path.
URLfind(String classname)
Obtains the URL of the specified class file.
InputStreamopenClassfile(String classname)
Obtains a class file from the class loader.
StringtoString()

Constructor Detail

LoaderClassPath

public LoaderClassPath(ClassLoader cl)
Creates a search path representing a class loader.

Method Detail

close

public void close()
Closes this class path.

find

public URL find(String classname)
Obtains the URL of the specified class file. This method calls getResource(String) on the class loader.

Returns: null if the class file could not be found.

openClassfile

public InputStream openClassfile(String classname)
Obtains a class file from the class loader. This method calls getResourceAsStream(String) on the class loader.

toString

public String toString()
Javassist, a Java-bytecode translator toolkit.
Copyright (C) 1999-2006 Shigeru Chiba. All Rights Reserved.