java.lang.Object
cloud.piranha.resource.DefaultResourceManager
- All Implemented Interfaces:
ResourceManager
public class DefaultResourceManager extends java.lang.Object implements ResourceManager
The default ResourceManager.
- Author:
- Manfred Riem ([email protected])
-
Constructor Summary
Constructors Constructor Description DefaultResourceManager()
-
Method Summary
Modifier and Type Method Description void
addResource(Resource resource)
Add resource.java.util.stream.Stream<java.lang.String>
getAllLocations()
Get all the locations for this resource manager.java.net.URL
getResource(java.lang.String location)
Get the resource URL.java.io.InputStream
getResourceAsStream(java.lang.String location)
Get the resource as a stream.java.util.Collection<java.net.URL>
getResources(java.lang.String location)
Get the resources.
-
Constructor Details
-
DefaultResourceManager
public DefaultResourceManager()
-
-
Method Details
-
addResource
Add resource.- Specified by:
addResource
in interfaceResourceManager
- Parameters:
resource
- the resource.
-
getResource
public java.net.URL getResource(java.lang.String location) throws java.net.MalformedURLExceptionGet the resource URL.- Specified by:
getResource
in interfaceResourceManager
- Parameters:
location
- the location.- Returns:
- the URL, or null if not found.
- Throws:
java.net.MalformedURLException
- when the location URL is malformed.
-
getResources
public java.util.Collection<java.net.URL> getResources(java.lang.String location) throws java.net.MalformedURLExceptionGet the resources.- Specified by:
getResources
in interfaceResourceManager
- Parameters:
location
- the location.- Returns:
- the collection with the resources.
- Throws:
java.net.MalformedURLException
- when the location URL is malformed.
-
getResourceAsStream
public java.io.InputStream getResourceAsStream(java.lang.String location)Get the resource as a stream.- Specified by:
getResourceAsStream
in interfaceResourceManager
- Parameters:
location
- the location.- Returns:
- the input stream, or null if not found.
-
getAllLocations
public java.util.stream.Stream<java.lang.String> getAllLocations()Description copied from interface:ResourceManager
Get all the locations for this resource manager.- Specified by:
getAllLocations
in interfaceResourceManager
- Returns:
- all the locations for this resource manager.
-