Class DefaultFileSystemResourceLoader

java.lang.Object
io.micronaut.core.io.file.DefaultFileSystemResourceLoader
All Implemented Interfaces:
FileSystemResourceLoader, ResourceLoader

public class DefaultFileSystemResourceLoader extends Object implements FileSystemResourceLoader
Loads resources from the file system.
Since:
1.0
Author:
James Kleeh
  • Constructor Details

    • DefaultFileSystemResourceLoader

      public DefaultFileSystemResourceLoader()
      Default constructor.
    • DefaultFileSystemResourceLoader

      public DefaultFileSystemResourceLoader(File baseDirPath)
      Parameters:
      baseDirPath - The base directory
    • DefaultFileSystemResourceLoader

      public DefaultFileSystemResourceLoader(String path)
      Parameters:
      path - The path
    • DefaultFileSystemResourceLoader

      public DefaultFileSystemResourceLoader(Path path)
      Parameters:
      path - The path
  • Method Details

    • getResourceAsStream

      public Optional<InputStream> getResourceAsStream(String path)
      Description copied from interface: ResourceLoader
      Obtains a resource as a stream.
      Specified by:
      getResourceAsStream in interface ResourceLoader
      Parameters:
      path - The path
      Returns:
      An optional resource
    • getResource

      public Optional<URL> getResource(String path)
      Description copied from interface: ResourceLoader
      Obtains the URL to a given resource.
      Specified by:
      getResource in interface ResourceLoader
      Parameters:
      path - The path
      Returns:
      An optional resource
    • getResources

      public Stream<URL> getResources(String name)
      Description copied from interface: ResourceLoader
      Obtains all resources with the given name.
      Specified by:
      getResources in interface ResourceLoader
      Parameters:
      name - The name of the resource
      Returns:
      A stream of URLs
    • forBase

      public ResourceLoader forBase(String basePath)
      Description copied from interface: ResourceLoader
      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.
      Specified by:
      forBase in interface ResourceLoader
      Parameters:
      basePath - The path to load resources
      Returns:
      The resource loader