Package com.blackrook.archetext.struct
Class PreprocessorLexer.DefaultIncluder
- java.lang.Object
-
- com.blackrook.archetext.struct.PreprocessorLexer.DefaultIncluder
-
- All Implemented Interfaces:
PreprocessorLexer.Includer
- Enclosing class:
- PreprocessorLexer
public static class PreprocessorLexer.DefaultIncluder extends Object implements PreprocessorLexer.Includer
Default includer to use when none specified. This includer can either pull from the classpath, URIs, or files.- Paths that start with
classpath:are parsed as resource paths in the current classpath. -
Else, the path is interpreted as a file path, with the following search order:
- Relative to parent of source stream.
- As is.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamgetIncludeResource(String path)Returns an openInputStreamfor a path when the parser needs a resource.StringgetIncludeResourcePath(String streamName, String path)Returns a full path for a path when the parser needs a resource.
-
-
-
Method Detail
-
getIncludeResourcePath
public String getIncludeResourcePath(String streamName, String path) throws IOException
Description copied from interface:PreprocessorLexer.IncluderReturns a full path for a path when the parser needs a resource.- Specified by:
getIncludeResourcePathin interfacePreprocessorLexer.Includer- Parameters:
streamName- the current name of the stream. This includer may use this to procure a relative path.path- the stream path from the include directive.- Returns:
- the path to a possible resource, or null if no possible path is available.
- Throws:
IOException- if an error occurs procuring a potential stream.
-
getIncludeResource
public InputStream getIncludeResource(String path) throws IOException
Description copied from interface:PreprocessorLexer.IncluderReturns an openInputStreamfor a path when the parser needs a resource. By default, this attempts to open a file at the provided path.- Specified by:
getIncludeResourcein interfacePreprocessorLexer.Includer- Parameters:
path- the resolved stream path from the include directive.- Returns:
- an open
InputStreamfor the requested resource, or null if not found. - Throws:
IOException- if an error occurs opening a stream.
-
-