Class ChildURLClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
de.iip_ecosphere.platform.support.plugins.ChildURLClassLoader
- All Implemented Interfaces:
ChildClassLoader,Closeable,AutoCloseable
A delegating child classloader to make internal methods accessible.
- Author:
- Stackoverflow
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionChildURLClassLoader(URL[] urls, FindClassClassLoader realParent) Creates an instance with delegation to the real parent class loader. -
Method Summary
Modifier and TypeMethodDescriptionClass<?> Finds and loads the class with the specified name from the URL search path.Class<?> findClassIntern(String name) Finds a class (no caching).getResource(String name) Finds the resource with the given name.getResourceAsStream(String name) Returns an input stream for reading the specified resource.getResources(String name) Finds all the resources with the given name.Methods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findResource, findResources, getPermissions, getURLs, newInstance, newInstanceMethods inherited from class java.security.SecureClassLoader
defineClass, defineClassMethods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSignersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.iip_ecosphere.platform.support.plugins.ChildClassLoader
clearAssertionStatus, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus
-
Field Details
-
realParent
-
-
Constructor Details
-
ChildURLClassLoader
Creates an instance with delegation to the real parent class loader.- Parameters:
urls- the URLs to load classes fromrealParent-
-
-
Method Details
-
getResource
Description copied from interface:ChildClassLoaderFinds the resource with the given name. A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is independent of the location of the code.- Specified by:
getResourcein interfaceChildClassLoader- Overrides:
getResourcein classClassLoader- Parameters:
name- The resource name- Returns:
- A
URLobject for reading the resource, or null if the resource could not be found or the invoker doesn't have adequate privileges to get the resource.
-
getResources
Description copied from interface:ChildClassLoaderFinds all the resources with the given name. A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is independent of the location of the code.- Specified by:
getResourcesin interfaceChildClassLoader- Overrides:
getResourcesin classClassLoader- Parameters:
name- The resource name- Returns:
- An enumeration of
URLobjects for the resource. If no resources could be found, the enumeration will be empty. Resources that the class loader doesn't have access to will not be in the enumeration. - Throws:
IOException- If I/O errors occur
-
getResourceAsStream
Description copied from interface:ChildClassLoaderReturns an input stream for reading the specified resource.- Specified by:
getResourceAsStreamin interfaceChildClassLoader- Overrides:
getResourceAsStreamin classURLClassLoader- Parameters:
name- The resource name- Returns:
- An input stream for reading the resource, or null if the resource could not be found
-
findClass
Description copied from interface:ChildClassLoaderFinds and loads the class with the specified name from the URL search path. Any URLs referring to JAR files are loaded and opened as needed until the class is found.- Specified by:
findClassin interfaceChildClassLoader- Overrides:
findClassin classURLClassLoader- Parameters:
name- the name of the class- Returns:
- the resulting class
- Throws:
ClassNotFoundException- if the class could not be found, or if the loader is closed.
-
findClassIntern
Finds a class (no caching).- Parameters:
name- the qualified class name- Returns:
- the class object
- Throws:
ClassNotFoundException- if the class cannot be found
-