java.lang.Object
com.github.rvesse.airline.parser.resources.FileLocator
All Implemented Interfaces:
ResourceLocator
Direct Known Subclasses:
AbstractPlaceholderLocator, HomeDirectoryLocator, WorkingDirectoryLocator

public class FileLocator extends Object implements ResourceLocator
A resource locator that does no resolution other than removing any leading file:// prefix i.e. treats paths as literal files

Derived implementations can override the resolve(String) method to apply some interpretation of the location to resolve special paths, variable references etc.

  • Field Details

  • Constructor Details

    • FileLocator

      public FileLocator()
  • Method Details

    • resolve

      protected String resolve(String searchLocation)
      Resolves the search location
      Parameters:
      searchLocation - Search location
      Returns:
      Resolved location
    • open

      public InputStream open(String searchLocation, String resourceName) throws IOException
      Description copied from interface: ResourceLocator
      Opens a search location, potentially applying some resolution rules to that location

      If the given resourceName exists in the search location then that resource should be returned. If that is not a valid resource but the search location itself is a valid resource then the locator should return that instead.

      Specified by:
      open in interface ResourceLocator
      Parameters:
      searchLocation - Search location
      resourceName - Resource name expected in the search location
      Returns:
      Input stream to read the search location or null if not a valid location
      Throws:
      IOException - Thrown if there is a problem accessing the search location