java.lang.Object
io.inverno.mod.base.resource.AbstractResource
io.inverno.mod.base.resource.AbstractAsyncResource
io.inverno.mod.base.resource.ZipResource
io.inverno.mod.base.resource.JarResource
- All Implemented Interfaces:
AsyncResource
,Resource
,AutoCloseable
A Resource
implementation that identifies resources by a URI of the form jar:file:/path/to/jar!/path/to/resource
and looks up data in a jar file on the file system system.
A typical usage is:
JarResource resource = new JarResource(URI.create("jar:file:/path/to/jar!/path/to/resource"));
...
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.inverno.mod.base.resource.AbstractAsyncResource
AbstractAsyncResource.EndOfFileException
-
Field Summary
Fields inherited from class io.inverno.mod.base.resource.ZipResource
resourcePath, SCHEME_JAR, SCHEME_ZIP, zipFsUri, zipUri
Fields inherited from class io.inverno.mod.base.resource.AbstractAsyncResource
DEFAULT_READ_BUFFER_CAPACITY
Fields inherited from class io.inverno.mod.base.resource.AbstractResource
IS_WINDOWS_PATH
-
Constructor Summary
ConstructorDescriptionJarResource
(URI uri) Creates a jar resource with the specified URI.JarResource
(URI uri, MediaTypeService mediaTypeService) Creates a jar resource with the specified URI and media type service. -
Method Summary
Methods inherited from class io.inverno.mod.base.resource.ZipResource
close, delete, exists, getFilename, getMediaType, getURI, isFile, lastModified, openReadableByteChannel, openWritableByteChannel, read, setExecutor, size, write
Methods inherited from class io.inverno.mod.base.resource.AbstractAsyncResource
getExecutor, setReadBufferCapacity
Methods inherited from class io.inverno.mod.base.resource.AbstractResource
getMediaTypeService, pathToSanitizedString, setMediaTypeService
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.inverno.mod.base.resource.Resource
openWritableByteChannel, openWritableByteChannel, resolve, write, write
-
Constructor Details
-
JarResource
Creates a jar resource with the specified URI.
- Parameters:
uri
- the resource URI- Throws:
IllegalArgumentException
- if the specified URI does not designate a jar resource
-
JarResource
Creates a jar resource with the specified URI and media type service.
- Parameters:
uri
- the resource URImediaTypeService
- a media type service- Throws:
IllegalArgumentException
- if the specified URI does not designate a jar resource
-
-
Method Details
-
checkUri
Checks that the specified URI is a jar resource URI.
- Parameters:
uri
- the uri to check- Returns:
- the uri if it is a jar resource URI
- Throws:
IllegalArgumentException
- if the specified URI does not designate a jar resource
-
resolve
Description copied from interface:Resource
Resolves the specified URI against the resource URI as defined by
Path.resolve(Path)
.- Specified by:
resolve
in interfaceResource
- Overrides:
resolve
in classZipResource
- Parameters:
path
- the path to resolve- Returns:
- a new resource resulting from the resolution of the specified path against the resource
- Throws:
ResourceException
- if there was an error resolving the resource
-