Package org.onehippo.repository.xml
Interface ContentResourceLoader
-
- All Known Implementing Classes:
FileContentResourceLoader
,ZipFileContentResourceLoader
public interface ContentResourceLoader
Strategy interface for loading resources (e.g, file system resources, zip entry resources or URI based resources).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description URL
getResource(String path)
Returns a URL to the resource that is mapped to the given path.InputStream
getResourceAsStream(String path)
Returns the resource located at the named path as anInputStream
object.
-
-
-
Method Detail
-
getResource
URL getResource(String path) throws MalformedURLException
Returns a URL to the resource that is mapped to the given path.The path must begin with a / and is interpreted as relative to the current content root.
This method returns
null
if no resource is mapped to the pathname.- Parameters:
path
- aString
specifying the path to the resource- Returns:
- the resource located at the named path,
or
null
if there is no resource at that path - Throws:
MalformedURLException
- if the pathname is not given in the correct form
-
getResourceAsStream
InputStream getResourceAsStream(String path) throws IOException
Returns the resource located at the named path as anInputStream
object.The path must be specified according to the rules given in
getResource
. This method returnsnull
if no resource exists at the specified path.- Parameters:
path
- aString
specifying the path to the resource- Returns:
- the
InputStream
returned to the caller, ornull
if no resource exists at the specified path - Throws:
IOException
-
-