railo.loader.classloader
Class RailoClassLoader

java.lang.Object
  extended byjava.lang.ClassLoader
      extended byrailo.loader.classloader.RailoClassLoader

public final class RailoClassLoader
extends java.lang.ClassLoader

This class implements a simple class loader that can be used to load at runtime classes contained in a JAR file.


Constructor Summary
RailoClassLoader(java.io.File jarFile, java.lang.ClassLoader parent)
          Creates a new JarClassLoader that will allow the loading of classes stored in a jar file.
RailoClassLoader(java.io.InputStream jar, java.lang.ClassLoader parent, boolean secure)
           
 
Method Summary
 java.lang.Class findClass(java.lang.String className)
          Looks among the contents of the jar file (cached in memory) and tries to find and define a class, given its name.
 java.io.InputStream getResourceAsStream(java.lang.String name)
           
 java.lang.Class loadClass(java.lang.String name)
          Loads the class with the specified name.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RailoClassLoader

public RailoClassLoader(java.io.File jarFile,
                        java.lang.ClassLoader parent)
                 throws java.io.IOException
Creates a new JarClassLoader that will allow the loading of classes stored in a jar file.

Parameters:
jarFile - the name of the jar file
parent - parent class loader
Throws:
java.io.IOException
java.io.IOException - an error happened while reading the contents of the jar file

RailoClassLoader

public RailoClassLoader(java.io.InputStream jar,
                        java.lang.ClassLoader parent,
                        boolean secure)
                 throws java.io.IOException
Method Detail

findClass

public java.lang.Class findClass(java.lang.String className)
                          throws java.lang.ClassNotFoundException
Looks among the contents of the jar file (cached in memory) and tries to find and define a class, given its name.

Parameters:
className - the name of the class
Returns:
a Class object representing our class
Throws:
java.lang.ClassNotFoundException - the jar file did not contain a class named className

loadClass

public java.lang.Class loadClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
Loads the class with the specified name. This method searches for classes in the same manner as the "loadClass(String, boolean)" method. It is called by the Java virtual machine to resolve class references. Calling this method is equivalent to calling loadClass(name, false).

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

getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.String name)
See Also:
ClassLoader.getResourceAsStream(java.lang.String)