public class ToplevelClassLoader extends ModuleClassLoader
ModuleClassLoader.CompoundIterator<T>
Modifier and Type | Field and Description |
---|---|
protected File[] |
theDirs
The local classes not packaged into Modules.
|
CANNOT_FIND_OBJECT, cannotFindTable, theDependencyClassLoaders, theDoNotLoadClassPrefixes, theModule, theStreamHandler
Constructor and Description |
---|
ToplevelClassLoader(File[] dirs,
ClassLoader parent,
ModuleClassLoader[] dependencyClassLoaders,
String[] doNotLoadClassPrefixes)
Construct one with the Module whose classes this ModuleClassLoader is
supposed to load, the parent/system ClassLoader, and the ClassLoaders of dependent Modules.
|
Modifier and Type | Method and Description |
---|---|
URL |
findResource(String name)
Find a URL.
|
Class |
loadClass(String name,
boolean resolve)
Override loadClass().
|
protected static byte[] |
slurpFile(File file)
Helper method to read a byte array from a File.
|
addModuleJarUrls, definePackage, getAndVerifyPackage, getDependencyClassLoaders, getModule, getModuleRegistry, getResource, getResources, slurpJarEntry, toString
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResourceAsStream, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
protected File[] theDirs
public ToplevelClassLoader(File[] dirs, ClassLoader parent, ModuleClassLoader[] dependencyClassLoaders, String[] doNotLoadClassPrefixes)
dirs
- identifies the local sources of classesparent
- the parent ClassLoader of this ClassLoaderdependencyClassLoaders
- the ModuleClassLoaders of the Module's dependent ModulesdoNotLoadClassPrefixes
- prefixes of classes always to be loaded through the system class loader, not this onepublic Class loadClass(String name, boolean resolve) throws ClassNotFoundException
loadClass
in class ModuleClassLoader
name
- name of the to-be-loaded classresolve
- do we also resolve the classClassNotFoundException
- loading the class failed, it could not be foundpublic URL findResource(String name)
findResource
in class ModuleClassLoader
name
- the name of the resourceprotected static byte[] slurpFile(File file) throws IOException
file
- the File from where to readIOException
- thrown if an I/O error occurredCopyright © 2018. All rights reserved.