Class FileResourceLoader<S>
- java.lang.Object
-
- fr.ens.biologie.genomique.eoulsan.util.AbstractResourceLoader<S>
-
- fr.ens.biologie.genomique.eoulsan.util.FileResourceLoader<S>
-
- Type Parameters:
S
- Type of the data to load
- All Implemented Interfaces:
ResourceLoader<S>
public abstract class FileResourceLoader<S> extends AbstractResourceLoader<S>
This class allow to define a resource loader for files.- Since:
- 2.0
- Author:
- Laurent Jourdren
-
-
Constructor Summary
Constructors Constructor Description FileResourceLoader(Class<S> clazz, DataFile resourcePath)
Public constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addResourcePath(DataFile resourcePath)
Add a resource path.void
addResourcePaths(Collection<String> resourcePaths)
Add a resource paths.protected abstract String
getExtension()
Get the extension of the files to load.protected InputStream
getResourceAsStream(String resourcePath)
Get the input stream related to a resource.void
reload()
Reload the list of available resources.boolean
removeResourcePath(DataFile resourcePath)
Add a resource path.-
Methods inherited from class fr.ens.biologie.genomique.eoulsan.util.AbstractResourceLoader
addResource, getResourceName, load, loadAllResources, loadResources
-
-
-
-
Method Detail
-
getExtension
protected abstract String getExtension()
Get the extension of the files to load.- Returns:
- the extension of the files to load
-
getResourceAsStream
protected InputStream getResourceAsStream(String resourcePath) throws IOException
Description copied from class:AbstractResourceLoader
Get the input stream related to a resource.- Specified by:
getResourceAsStream
in classAbstractResourceLoader<S>
- Parameters:
resourcePath
- resource path- Returns:
- a resource object
- Throws:
IOException
- if an error occurs while creating the input stream
-
reload
public void reload()
Description copied from interface:ResourceLoader
Reload the list of available resources.
-
addResourcePaths
public void addResourcePaths(Collection<String> resourcePaths)
Add a resource paths.- Parameters:
resourcePaths
- the resource path to add
-
addResourcePath
public void addResourcePath(DataFile resourcePath)
Add a resource path.- Parameters:
resourcePath
- the resource path to add
-
removeResourcePath
public boolean removeResourcePath(DataFile resourcePath)
Add a resource path.- Parameters:
resourcePath
- the resource path to remove- Returns:
- true if the resource has been successfully removed
-
-