Class I18n.FileResourceClassLoader
- Enclosing class:
- I18n
- Since:
- 1.8.0
-
Constructor Summary
ConstructorsConstructorDescriptionFileResourceClassLoader(@NotNull ClassLoader classLoader, @NotNull org.bukkit.plugin.Plugin plugin) Creates a new file resource class loader. -
Method Summary
Modifier and TypeMethodDescription@Nullable URLgetResource(@NotNull String name) Finds the resource with the given name.@Nullable InputStreamgetResourceAsStream(String name) Returns an input stream for reading the specified resource.Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
FileResourceClassLoader
public FileResourceClassLoader(@NotNull @NotNull ClassLoader classLoader, @NotNull @NotNull org.bukkit.plugin.Plugin plugin) Creates a new file resource class loader.- Parameters:
classLoader- The class loader.plugin- The plugin.- Since:
- 1.8.0
-
-
Method Details
-
getResource
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.The name of a resource is a '
/'-separated path name that identifies the resource.Resources in named modules are subject to the encapsulation rules specified by
Module.getResourceAsStream. Additionally, and except for the special case where the resource has a name ending with ".class", this method will only find resources in packages of named modules when the package isopenedunconditionally (even if the caller of this method is in the same module as the resource).- Overrides:
getResourcein classClassLoader- Parameters:
name- The resource name- Returns:
URLobject for reading the resource;nullif the resource could not be found, aURLcould not be constructed to locate the resource, the resource is in a package that is not opened unconditionally, or access to the resource is denied by the security manager.- Throws:
NullPointerException- IfnameisnullWhen overriding this method it is recommended that an implementation ensures that any delegation is consistent with thegetResources(String)method.- Since:
- 1.8.0
-
getResourceAsStream
Returns an input stream for reading the specified resource.The search order is described in the documentation for
getResource(String).Resources in named modules are subject to the encapsulation rules specified by
Module.getResourceAsStream. Additionally, and except for the special case where the resource has a name ending with ".class", this method will only find resources in packages of named modules when the package isopenedunconditionally.- Overrides:
getResourceAsStreamin classClassLoader- Parameters:
name- The resource name- Returns:
- An input stream for reading the resource;
nullif the resource could not be found, the resource is in a package that is not opened unconditionally, or access to the resource is denied by the security manager. - Throws:
NullPointerException- Ifnameisnull- Since:
- 1.8.0
-