Class DirectoryLoader


  • public class DirectoryLoader
    extends java.lang.ClassLoader
    DirectoryLoader is a simple ClassLoader which loads from a specified file system directory.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Hashtable<java.lang.String,​java.lang.Class<?>> cache  
      private java.io.File root  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private DirectoryLoader()  
        DirectoryLoader​(java.io.File rootDir)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private byte[] getClassFileData​(java.lang.String className)
      Reurn a byte array containing the contents of the class file.
      java.lang.Class<?> loadClass​(java.lang.String className)
      Convenience version of loadClass which sets 'resolve' == true.
      java.lang.Class<?> loadClass​(java.lang.String className, boolean resolve)
      This is the required version of loadClass which is called both from loadClass above and from the internal function FindClassFromClass.
      • Methods inherited from class java.lang.ClassLoader

        clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • cache

        private java.util.Hashtable<java.lang.String,​java.lang.Class<?>> cache
      • root

        private java.io.File root
    • Constructor Detail

      • DirectoryLoader

        public DirectoryLoader​(java.io.File rootDir)
        Constructor.
      • DirectoryLoader

        private DirectoryLoader()
    • Method Detail

      • loadClass

        public java.lang.Class<?> loadClass​(java.lang.String className)
                                     throws java.lang.ClassNotFoundException
        Convenience version of loadClass which sets 'resolve' == true.
        Overrides:
        loadClass in class java.lang.ClassLoader
        Throws:
        java.lang.ClassNotFoundException
      • loadClass

        public java.lang.Class<?> loadClass​(java.lang.String className,
                                            boolean resolve)
                                     throws java.lang.ClassNotFoundException
        This is the required version of loadClass which is called both from loadClass above and from the internal function FindClassFromClass.
        Overrides:
        loadClass in class java.lang.ClassLoader
        Throws:
        java.lang.ClassNotFoundException
      • getClassFileData

        private byte[] getClassFileData​(java.lang.String className)
        Reurn a byte array containing the contents of the class file. Returns null if an exception occurs.