|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tika.config.ServiceLoader
public class ServiceLoader
Internal utility class that Tika uses to look up service providers.
Constructor Summary | |
---|---|
ServiceLoader()
|
|
ServiceLoader(ClassLoader loader)
|
|
ServiceLoader(ClassLoader loader,
LoadErrorHandler handler)
|
|
ServiceLoader(ClassLoader loader,
LoadErrorHandler handler,
boolean dynamic)
|
Method Summary | ||
---|---|---|
Enumeration<URL> |
findServiceResources(String filePattern)
Returns all the available service resources matching the given pattern, such as all instances of tika-mimetypes.xml on the classpath, or all org.apache.tika.parser.Parser service files. |
|
InputStream |
getResourceAsStream(String name)
Returns an input stream for reading the specified resource from the configured class loader. |
|
|
getServiceClass(Class<T> iface,
String name)
Loads and returns the named service class that's expected to implement the given interface. |
|
|
loadServiceProviders(Class<T> iface)
Returns all the available service providers of the given type. |
|
static void |
setContextClassLoader(ClassLoader loader)
Sets the context class loader to use for all threads that access this class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ServiceLoader(ClassLoader loader, LoadErrorHandler handler, boolean dynamic)
public ServiceLoader(ClassLoader loader, LoadErrorHandler handler)
public ServiceLoader(ClassLoader loader)
public ServiceLoader()
Method Detail |
---|
public static void setContextClassLoader(ClassLoader loader)
loader
- default context class loader,
or null
to automatically pick the loaderpublic InputStream getResourceAsStream(String name)
name
- resource name
null
if the resource was not foundClassLoader.getResourceAsStream(String)
public <T> Class<? extends T> getServiceClass(Class<T> iface, String name) throws ClassNotFoundException
iface
- service interfacename
- service class name
ClassNotFoundException
- if the service class can not be found
or does not implement the given interfaceClass.forName(String, boolean, ClassLoader)
public Enumeration<URL> findServiceResources(String filePattern)
public <T> List<T> loadServiceProviders(Class<T> iface)
iface
- service provider interface
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |