Package org.onehippo.repository.util
Class ZipFileContentResourceLoader
- java.lang.Object
-
- org.onehippo.repository.util.ZipFileContentResourceLoader
-
- All Implemented Interfaces:
ContentResourceLoader
public class ZipFileContentResourceLoader extends Object implements ContentResourceLoader
ContentResourceLoader
implementation for loading resources from a zip file.
-
-
Constructor Summary
Constructors Constructor Description ZipFileContentResourceLoader(ZipFile zipFile)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description URL
getResource(String path)
Returns a URL in jar URL scheme.InputStream
getResourceAsStream(String path)
Returns the resource located at the named path as anInputStream
object.
-
-
-
Constructor Detail
-
ZipFileContentResourceLoader
public ZipFileContentResourceLoader(ZipFile zipFile)
-
-
Method Detail
-
getResource
public URL getResource(String path) throws MalformedURLException
Returns a URL in jar URL scheme.- Specified by:
getResource
in interfaceContentResourceLoader
- 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- See Also:
- http://en.wikipedia.org/wiki/URI_scheme, https://www.iana.org/assignments/uri-schemes/prov/jar
-
getResourceAsStream
public InputStream getResourceAsStream(String path) throws IOException
Description copied from interface:ContentResourceLoader
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.- Specified by:
getResourceAsStream
in interfaceContentResourceLoader
- 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
-
-