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

class ChildURLClassLoader extends URLClassLoader implements ChildClassLoader
A delegating child classloader to make internal methods accessible.
Author:
Stackoverflow
  • Field Details

  • Constructor Details

    • ChildURLClassLoader

      public ChildURLClassLoader(URL[] urls, FindClassClassLoader realParent)
      Creates an instance with delegation to the real parent class loader.
      Parameters:
      urls - the URLs to load classes from
      realParent -
  • Method Details

    • getResource

      public URL getResource(String name)
      Description copied from interface: ChildClassLoader
      Finds 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:
      getResource in interface ChildClassLoader
      Overrides:
      getResource in class ClassLoader
      Parameters:
      name - The resource name
      Returns:
      A URL object 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

      public Enumeration<URL> getResources(String name) throws IOException
      Description copied from interface: ChildClassLoader
      Finds 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:
      getResources in interface ChildClassLoader
      Overrides:
      getResources in class ClassLoader
      Parameters:
      name - The resource name
      Returns:
      An enumeration of URL objects 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

      public InputStream getResourceAsStream(String name)
      Description copied from interface: ChildClassLoader
      Returns an input stream for reading the specified resource.
      Specified by:
      getResourceAsStream in interface ChildClassLoader
      Overrides:
      getResourceAsStream in class URLClassLoader
      Parameters:
      name - The resource name
      Returns:
      An input stream for reading the resource, or null if the resource could not be found
    • findClass

      public Class<?> findClass(String name) throws ClassNotFoundException
      Description copied from interface: ChildClassLoader
      Finds 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:
      findClass in interface ChildClassLoader
      Overrides:
      findClass in class URLClassLoader
      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

      public Class<?> findClassIntern(String name) throws ClassNotFoundException
      Finds a class (no caching).
      Parameters:
      name - the qualified class name
      Returns:
      the class object
      Throws:
      ClassNotFoundException - if the class cannot be found