Class AbstractResourceLoader<S>
- java.lang.Object
- 
- fr.ens.biologie.genomique.eoulsan.util.AbstractResourceLoader<S>
 
- 
- Type Parameters:
- S- Type of the data to load
 - All Implemented Interfaces:
- ResourceLoader<S>
 - Direct Known Subclasses:
- ClassPathResourceLoader,- FileResourceLoader
 
 public abstract class AbstractResourceLoader<S> extends Object implements ResourceLoader<S> This class define an abstract resource loader.- Since:
- 2.0
- Author:
- Laurent Jourdren
 
- 
- 
Constructor SummaryConstructors Constructor Description AbstractResourceLoader()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddResource(String resourceName, String resourcePath)Add a resource.protected abstract InputStreamgetResourceAsStream(String resourcePath)Get the input stream related to a resource.protected abstract StringgetResourceName(S resource)Get the resource name.protected abstract Sload(InputStream in, String source)Load a resource.List<S>loadAllResources()Load all available resources.List<S>loadResources(String resourceName)Load a resource.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface fr.ens.biologie.genomique.eoulsan.util.ResourceLoaderreload
 
- 
 
- 
- 
- 
Method Detail- 
getResourceAsStreamprotected abstract InputStream getResourceAsStream(String resourcePath) throws IOException Get the input stream related to a resource.- Parameters:
- resourcePath- resource path
- Returns:
- a resource object
- Throws:
- IOException- if an error occurs while creating the input stream
 
 - 
loadprotected abstract S load(InputStream in, String source) throws IOException, EoulsanException Load a resource.- Parameters:
- in- input stream
- source- source of the resource
- Returns:
- a resource object
- Throws:
- IOException- if an error occurs while loading the resource
- EoulsanException- if an error occurs while creating the resource object
 
 - 
getResourceNameprotected abstract String getResourceName(S resource) Get the resource name.- Parameters:
- resource- the resource
- Returns:
- the name of the resource
 
 - 
addResourceprotected void addResource(String resourceName, String resourcePath) Add a resource.- Parameters:
- resourceName- resource name
- resourcePath- resource path
 
 - 
loadAllResourcespublic List<S> loadAllResources() Description copied from interface:ResourceLoaderLoad all available resources.- Specified by:
- loadAllResourcesin interface- ResourceLoader<S>
- Returns:
- a list with all the loaded resources
 
 - 
loadResourcespublic List<S> loadResources(String resourceName) Description copied from interface:ResourceLoaderLoad a resource.- Specified by:
- loadResourcesin interface- ResourceLoader<S>
- Parameters:
- resourceName- name of the resource to load
- Returns:
- a list the loaded resources that had the requested name
 
 
- 
 
-