-
public class ResourceLoaderLoad resources
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceResourceLoader.ClassFactoryThe utility methods will try to use the provided class factories to convert binary name of class to Class object. Used by H2 OSGi Activator in order to provide a class from another bundle ClassLoader.
-
Field Summary
Fields Modifier and Type Field Description public final static ResourceLoaderINSTANCE
-
Method Summary
Modifier and Type Method Description final UnitaddClassFactory(ResourceLoader.ClassFactory classFactory)Add a class factory in order to manage more than one class loader. final UnitremoveClassFactory(ResourceLoader.ClassFactory classFactory)Remove a class factory final <Z extends Any> Class<Z>loadUserClass(String className)Load a class, but check if it is allowed to load this class first. final List<String>readAllLines(String stringResource, String fileResource, String resourcePrefix)Read all lines from one of the following resource: string, file by file name and resource by resource name The front resource have higher priority final List<String>readAllLines(String stringResource, String fileResource)Read all lines from one of the following resource: string, file by file name and resource by resource name The front resource have higher priority final List<String>readAllLines(String fileResource)final List<String>readAllLines(String fileResource, Boolean filter)final List<String>readAllLinesNoFilter(String fileResource)final List<String>readAllLinesIfModified(Path path)final StringreadString(String fileResource)final StringBuilderreadStringTo(String fileResource, StringBuilder sb)final InputStreamgetResourceAsStream(String name)Get a Reader attached to the configuration resource with the given name.final InputStreamgetResourceAsStream(String name, String resourcePrefixes)Find the first resource associated by prefix/name final ReadergetResourceAsReader(String fileResource, String resourcePrefixes)Get a Reader attached to the configuration resource with the given name.final Booleanexists(String name)final URLgetResource(String name)Get the URL for the named resource. final <T extends Any> URLgetResource(String name, Class<T> preferredClassLoader)Get the URL for the named resource. final ReadergetMultiSourceReader(String stringResource, String fileResource)final ReadergetMultiSourceReader(String stringResource, String namedResource, String resourcePrefix)-
-
Method Detail
-
addClassFactory
final Unit addClassFactory(ResourceLoader.ClassFactory classFactory)
Add a class factory in order to manage more than one class loader.
- Parameters:
classFactory- An object that implements ClassFactory
-
removeClassFactory
final Unit removeClassFactory(ResourceLoader.ClassFactory classFactory)
Remove a class factory
- Parameters:
classFactory- Already inserted class factory instance
-
loadUserClass
final <Z extends Any> Class<Z> loadUserClass(String className)
Load a class, but check if it is allowed to load this class first. To perform access rights checking, the system property h2.allowedClasses needs to be set to a list of class file name prefixes.
- Parameters:
className- the name of the class
-
readAllLines
@JvmOverloads() final List<String> readAllLines(String stringResource, String fileResource, String resourcePrefix)
Read all lines from one of the following resource: string, file by file name and resource by resource name The front resource have higher priority
-
readAllLines
@JvmOverloads() final List<String> readAllLines(String stringResource, String fileResource)
Read all lines from one of the following resource: string, file by file name and resource by resource name The front resource have higher priority
-
readAllLines
final List<String> readAllLines(String fileResource)
-
readAllLines
final List<String> readAllLines(String fileResource, Boolean filter)
-
readAllLinesNoFilter
final List<String> readAllLinesNoFilter(String fileResource)
-
readAllLinesIfModified
final List<String> readAllLinesIfModified(Path path)
-
readString
final String readString(String fileResource)
-
readStringTo
final StringBuilder readStringTo(String fileResource, StringBuilder sb)
-
getResourceAsStream
final InputStream getResourceAsStream(String name)
Get a Reader attached to the configuration resource with the given
name.- Parameters:
name- resource name.
-
getResourceAsStream
final InputStream getResourceAsStream(String name, String resourcePrefixes)
Find the first resource associated by prefix/name
-
getResourceAsReader
final Reader getResourceAsReader(String fileResource, String resourcePrefixes)
Get a Reader attached to the configuration resource with the given
name.- Parameters:
fileResource- configuration resource name.
-
getResource
final URL getResource(String name)
Get the URL for the named resource.
Finds a resource with a given name. Find resources first by each registered class loader and then by the default class loader.
- Parameters:
name- name of the desired resource
-
getResource
final <T extends Any> URL getResource(String name, Class<T> preferredClassLoader)
Get the URL for the named resource.
- Parameters:
name- resource name.preferredClassLoader- preferred class loader, this class loader is used first, fallback to other class loaders if the resource not found by preferred class loader.
-
getMultiSourceReader
final Reader getMultiSourceReader(String stringResource, String fileResource)
-
getMultiSourceReader
final Reader getMultiSourceReader(String stringResource, String namedResource, String resourcePrefix)
-
-
-
-