This classloader can be used when the resources for the to be loaded classes can be retrieved from one or multiple ClassLoaderDataFinder instance(s).
Users should keep track of the data finders which are used to construct a classloader and manually close them later,
when the classloader is no longer used. It's also possible to keep a PhantomReference to the classloader
instance, and when the classloader is garbage collected, close the data finders. It requires more implementational
code, or maybe use the Cleaner
class, but that is only available from JRE9+.
When a resource retrieval is requested from the classloader, it will iterate through the data finders registered in it, and return the first match that is found for the resource. The data finders are iterated in the order as it was specified during initialization.
The classloader doesn't implement the ClassLoader.findLibrary(
public | MultiDataClassLoader( Creates a new instance. |
public | MultiDataClassLoader( Creates a new instance. |
public | MultiDataClassLoader( Creates a new instance. |
public | MultiDataClassLoader( Creates a new instance. |
protected Class< | Finds the class with the specified binary name. |
protected URL | findResource( Finds the resource with the given name. |
protected Enumeration< | findResources( Returns an enumeration of URL objects representing all the resources with the given
name. |
public Collection< | Gets the data finders which are used by this classloader. |
protected ProtectionDomain | getProtectionDomain( Gets the protection domain that should be used when defining a class. |
public InputStream | getResourceAsStream( Returns an input stream for reading the specified resource. |
public String | toString() Returns a string representation of the object. |
Duplicates are removed from the argument data finders.
null
.Duplicates are removed from the argument data finders.
null
.Duplicates are removed from the argument data finders.
null
.Duplicates are removed from the argument data finders.
null
.This method can be overridden by subclasses to provide a ProtectionDomain to use when defining a class.
The default implementation returns null
.
null
.
The search order is described in the documentation for ClassLoader.getResource(
toString
method returns a string that
"textually represents" this object. The result should be a concise but informative representation that is easy
for a person to read. It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of
which the object is an instance, the at-sign character `@
', and the unsigned hexadecimal representation
of the hash code of the object. In other words, this method returns a string equal to the value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())