Provides a unified access to resources, giving the ability to obtain Resource
instances for various kind of resources.
Implementations can rely on multiple ResourceProvider
to resolve resources based on their kind specified in the scheme of the resource URI.
- Author:
- Jeremy Kuhn
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetResource
(URI uri) Resolves the resource identified by the specified URI.getResources
(URI uri) Resolves the resources that exist the location identified by the specified URI.
-
Method Details
-
getResource
Resolves the resource identified by the specified URI.
The resource returned by this method might not actually exist.
- Parameters:
uri
- a URI- Returns:
- A resource
- Throws:
NullPointerException
- if the specified URI is nullIllegalArgumentException
- if the resource type specified in the URI is not supported by the implementationResourceException
- if there was an error resolving the resource
-
getResources
Stream<Resource> getResources(URI uri) throws NullPointerException, IllegalArgumentException, ResourceException Resolves the resources that exist the location identified by the specified URI.
The returned result depends on the type of resource considered and the corresponding
ResourceProvider
. For instance a file resource provider could implement some kind of pattern in the specified URI to return multiple resources (eg.file:/a/**/b.txt
), but not all kind of resources can be listed in such a way, for instance it is not possible to list resources on a classpath or at a given URL.- Parameters:
uri
- a URI- Returns:
- an stream of resources
- Throws:
NullPointerException
- if the specified URI is nullIllegalArgumentException
- if the resource type specified in the URI is not supported by the implementationResourceException
- if there was an error resolving the resource
-