com.javageeks.classloader
Class FileSystemClassLoader

java.lang.Object
  |
  +--java.lang.ClassLoader
        |
        +--com.javageeks.classloader.FileSystemClassLoader
All Implemented Interfaces:
ClassLoaderStrategy, java.io.Serializable

public class FileSystemClassLoader
extends java.lang.ClassLoader
implements ClassLoaderStrategy

See Also:
Serialized Form

Constructor Summary
FileSystemClassLoader()
          Default constructor uses the home directory of the JDK as its root in the filesystem.
FileSystemClassLoader(java.lang.ClassLoader parent)
          Default constructor uses the home directory of the JDK as its root in the filesystem.
FileSystemClassLoader(java.lang.ClassLoader parent, java.lang.String root)
          Constructor taking a String indicating the point on the local filesystem to take as the root in the filesystem.
FileSystemClassLoader(java.lang.String root)
          Constructor taking a String indicating the point on the local filesystem to take as the root in the filesystem.
 
Method Summary
 java.lang.Class findClass(java.lang.String name)
          Attempt to find the bytecode given for the class name from a file on disk.
 byte[] findClassBytes(java.lang.String className)
          Return byte array (which will be turned into a Class instance via ClassLoader.defineClass) for class
 java.lang.String findLibraryPath(java.lang.String libraryName)
          Return full path to native library given by the name libraryName.
 java.util.Enumeration findResourcesEnum(java.lang.String resourceName)
          Return Enumeration of resources corresponding to resourceName.
 java.net.URL findResourceURL(java.lang.String resourceName)
          Return URL for resource given by resourceName
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.ClassLoader
defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemClassLoader

public FileSystemClassLoader()
                      throws java.io.FileNotFoundException
Default constructor uses the home directory of the JDK as its root in the filesystem.

FileSystemClassLoader

public FileSystemClassLoader(java.lang.String root)
                      throws java.io.FileNotFoundException
Constructor taking a String indicating the point on the local filesystem to take as the root in the filesystem.

FileSystemClassLoader

public FileSystemClassLoader(java.lang.ClassLoader parent)
                      throws java.io.FileNotFoundException
Default constructor uses the home directory of the JDK as its root in the filesystem.

FileSystemClassLoader

public FileSystemClassLoader(java.lang.ClassLoader parent,
                             java.lang.String root)
                      throws java.io.FileNotFoundException
Constructor taking a String indicating the point on the local filesystem to take as the root in the filesystem.
Method Detail

findClassBytes

public byte[] findClassBytes(java.lang.String className)
Return byte array (which will be turned into a Class instance via ClassLoader.defineClass) for class
Specified by:
findClassBytes in interface ClassLoaderStrategy

findResourceURL

public java.net.URL findResourceURL(java.lang.String resourceName)
Return URL for resource given by resourceName
Specified by:
findResourceURL in interface ClassLoaderStrategy

findResourcesEnum

public java.util.Enumeration findResourcesEnum(java.lang.String resourceName)
Return Enumeration of resources corresponding to resourceName.
Specified by:
findResourcesEnum in interface ClassLoaderStrategy

findLibraryPath

public java.lang.String findLibraryPath(java.lang.String libraryName)
Return full path to native library given by the name libraryName.
Specified by:
findLibraryPath in interface ClassLoaderStrategy

findClass

public java.lang.Class findClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
Attempt to find the bytecode given for the class name from a file on disk. Will not look along CLASSPATH, nor in .jar files
Overrides:
findClass in class java.lang.ClassLoader

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception