Openfire 3.6.0 Javadoc

org.jivesoftware.util
Class ClassUtils

java.lang.Object
  extended by org.jivesoftware.util.ClassUtils

public class ClassUtils
extends Object

A utility class to assist with loading classes or resources by name. Many application servers use custom classloaders, which will break uses of:

    Class.forName(className);
 
This utility attempts to load the class or resource using a number of different mechanisms to work around this problem.

Author:
Matt Tucker

Method Summary
static Class forName(String className)
          Loads the class with the specified name.
static InputStream getResourceAsStream(String name)
          Loads the given resource as a stream.
 Class loadClass(String className)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

forName

public static Class forName(String className)
                     throws ClassNotFoundException
Loads the class with the specified name.

Parameters:
className - the name of the class
Returns:
the resulting Class object
Throws:
ClassNotFoundException - if the class was not found

getResourceAsStream

public static InputStream getResourceAsStream(String name)
Loads the given resource as a stream.

Parameters:
name - the name of the resource that exists in the classpath.
Returns:
the resource as an input stream or null if the resource was not found.

loadClass

public Class loadClass(String className)
                throws ClassNotFoundException
Throws:
ClassNotFoundException

Openfire 3.6.0 Javadoc

Copyright © 2003-2008 Jive Software.