Interface ResourceLoader

All Known Subinterfaces:
ClassPathResourceLoader, Environment, FileSystemResourceLoader
All Known Implementing Classes:
DefaultClassPathResourceLoader, DefaultEnvironment, DefaultFileSystemResourceLoader

@Indexed(ResourceLoader.class) public interface ResourceLoader
Basic abstraction over resource loading.
Since:
1.0
Author:
Graeme Rocher
  • Method Details

    • getResourceAsStream

      Optional<InputStream> getResourceAsStream(String path)
      Obtains a resource as a stream.
      Parameters:
      path - The path
      Returns:
      An optional resource
    • getResource

      Optional<URL> getResource(String path)
      Obtains the URL to a given resource.
      Parameters:
      path - The path
      Returns:
      An optional resource
    • getResources

      Stream<URL> getResources(String name)
      Obtains all resources with the given name.
      Parameters:
      name - The name of the resource
      Returns:
      A stream of URLs
    • supportsPrefix

      boolean supportsPrefix(String path)
      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

      ResourceLoader forBase(String basePath)
      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