public abstract class ResourceLoader extends Object
Defines a general access point of loading any text resources and services.
Specification: All external subclasses must have a public no-arg constructor.
| Modifier and Type | Field and Description |
|---|---|
static String |
EXTERNAL_RESOURCE_LOADER
Name der system property, über die eine externe Instanz mittels eines vollständig
qualifizierten Klassennamens verwendet wird.
|
static String |
USE_OF_CLASSLOADER_ONLY
Name der system property, die kontrolliert, ob nur der Classloader statt einer
URI-Konstruktion verwendet werden soll.
|
| Modifier and Type | Method and Description |
|---|---|
static ResourceLoader |
getInstance()
Applications should never use the constructor but this static method to achieve a general instance.
|
InputStream |
load(Class<?> moduleRef,
String path,
boolean noCache)
Loads a resource as input stream based on the classloader of given module reference.
|
abstract InputStream |
load(URI uri,
boolean noCache)
Loads given URI-resource as input stream.
|
abstract URI |
locate(String moduleName,
Class<?> moduleRef,
String path)
Constructs an URI for given module resource.
|
abstract <S> Iterable<S> |
services(Class<S> serviceInterface)
Finds a collection of service providers available for given service provider interface.
|
public static final String EXTERNAL_RESOURCE_LOADER
Name der system property, über die eine externe Instanz mittels eines vollständig qualifizierten Klassennamens verwendet wird.
Time4J wird einen Error werfen, wenn der Konfigurationseintrag falsch ist.
public static final String USE_OF_CLASSLOADER_ONLY
Name der system property, die kontrolliert, ob nur der Classloader statt einer URI-Konstruktion verwendet werden soll.
Der Wert ist entweder "true" oder "false" (Vorgabe). Auf Android wird diese Eigenschaft ignoriert.
public static ResourceLoader getInstance()
Applications should never use the constructor but this static method to achieve a general instance.
ResourceLoaderpublic abstract URI locate(String moduleName, Class<?> moduleRef, String path)
Constructs an URI for given module resource.
Attention: Some implementations might yield an uri without verifying if the uri resource really exists.
moduleName - name of related time4j-modulemoduleRef - module-specific class referencepath - path to text resourcenull if unable to locate the resourcepublic abstract InputStream load(URI uri, boolean noCache)
Loads given URI-resource as input stream.
Callers are responsible for closing the result stream.
uri - uniform resource identifier as result of locate-method (optional)noCache - avoid caching?null if the resource could not be openedlocate(String, Class, String)public final InputStream load(Class<?> moduleRef, String path, boolean noCache) throws IOException
Loads a resource as input stream based on the classloader of given module reference.
Callers are responsible for closing the result stream.
moduleRef - module-specific class referencepath - path to text resource (must be understandable by class loaders)noCache - avoid caching?IOException - if the stream cannot be opened or if this method is called on Android platformspublic abstract <S> Iterable<S> services(Class<S> serviceInterface)
Finds a collection of service providers available for given service provider interface.
S - generic service typeserviceInterface - service provider interfaceCopyright © 2014–2017. All rights reserved.