Module com.github.rvesse.airline
Class FileLocator
- java.lang.Object
-
- com.github.rvesse.airline.parser.resources.FileLocator
-
- All Implemented Interfaces:
ResourceLocator
- Direct Known Subclasses:
AbstractPlaceholderLocator,HomeDirectoryLocator,WorkingDirectoryLocator
public class FileLocator extends java.lang.Object implements ResourceLocator
A resource locator that does no resolution other than removing any leadingfile://prefix i.e. treats paths as literal filesDerived implementations can override the
resolve(String)method to apply some interpretation of the location to resolve special paths, variable references etc.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFILE_URI_PREFIX
-
Constructor Summary
Constructors Constructor Description FileLocator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.InputStreamopen(java.lang.String searchLocation, java.lang.String resourceName)Opens a search location, potentially applying some resolution rules to that locationprotected java.lang.Stringresolve(java.lang.String searchLocation)Resolves the search location
-
-
-
Field Detail
-
FILE_URI_PREFIX
public static final java.lang.String FILE_URI_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
resolve
protected java.lang.String resolve(java.lang.String searchLocation)
Resolves the search location- Parameters:
searchLocation- Search location- Returns:
- Resolved location
-
open
public java.io.InputStream open(java.lang.String searchLocation, java.lang.String resourceName) throws java.io.IOExceptionDescription copied from interface:ResourceLocatorOpens a search location, potentially applying some resolution rules to that locationIf the given
resourceNameexists 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:
openin interfaceResourceLocator- Parameters:
searchLocation- Search locationresourceName- Resource name expected in the search location- Returns:
- Input stream to read the search location or
nullif not a valid location - Throws:
java.io.IOException- Thrown if there is a problem accessing the search location
-
-