Package org.apache.lucene.analysis.util
Class ClasspathResourceLoader
java.lang.Object
org.apache.lucene.analysis.util.ClasspathResourceLoader
- All Implemented Interfaces:
ResourceLoader
Simple
ResourceLoader that uses ClassLoader.getResourceAsStream(String)
and Class.forName(String,boolean,ClassLoader) to open resources and
classes, respectively.-
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance using the context classloader to load Resources and classes.ClasspathResourceLoader(Class<?> clazz) Creates an instance using the context classloader to load Resources and classes Resources are resolved relative to the given class, if path is not absolute.ClasspathResourceLoader(ClassLoader loader) Creates an instance using the given classloader to load Resources and classes. -
Method Summary
Modifier and TypeMethodDescription<T> Class<? extends T> Finds class of the name and expected type<T> TnewInstance(String cname, Class<T> expectedType) Creates an instance of the name and expected typeopenResource(String resource) Opens a named resource
-
Constructor Details
-
ClasspathResourceLoader
public ClasspathResourceLoader()Creates an instance using the context classloader to load Resources and classes. Resource paths must be absolute. -
ClasspathResourceLoader
Creates an instance using the given classloader to load Resources and classes. Resource paths must be absolute. -
ClasspathResourceLoader
Creates an instance using the context classloader to load Resources and classes Resources are resolved relative to the given class, if path is not absolute.
-
-
Method Details
-
openResource
Description copied from interface:ResourceLoaderOpens a named resource- Specified by:
openResourcein interfaceResourceLoader- Throws:
IOException
-
findClass
Description copied from interface:ResourceLoaderFinds class of the name and expected type- Specified by:
findClassin interfaceResourceLoader
-
newInstance
Description copied from interface:ResourceLoaderCreates an instance of the name and expected type- Specified by:
newInstancein interfaceResourceLoader
-