Package io.micronaut.core.io
Interface ResourceLoader
- All Known Subinterfaces:
ClassPathResourceLoader,Environment,FileSystemResourceLoader
- All Known Implementing Classes:
Base64ResourceLoader,DefaultClassPathResourceLoader,DefaultEnvironment,DefaultFileSystemResourceLoader,StringResourceLoader
Basic abstraction over resource loading.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Method Summary
Modifier and TypeMethodDescriptionConstructs a new resource loader designed to load resources from the given path.getResource(String path) Obtains the URL to a given resource.getResourceAsStream(String path) Obtains a resource as a stream.getResources(String name) Obtains all resources with the given name.booleansupportsPrefix(String path)
-
Method Details
-
getResourceAsStream
Obtains a resource as a stream.- Parameters:
path- The path- Returns:
- An optional resource
-
getResource
Obtains the URL to a given resource.- Parameters:
path- The path- Returns:
- An optional resource
-
getResources
Obtains all resources with the given name.- Parameters:
name- The name of the resource- Returns:
- A stream of URLs
-
supportsPrefix
- Parameters:
path- The path to a resource including a prefix appended by a colon. Ex (classpath:, file:)- Returns:
- Whether the given resource loader supports the prefix
-
forBase
Constructs a new resource loader designed to load resources from the given path. Requested resources will be loaded within the context of the given path.- Parameters:
basePath- The path to load resources- Returns:
- The new
ResourceLoader
-