Class CompiledIncludeNode
java.lang.Object
org.mvel2.templates.res.Node
org.mvel2.templates.res.CompiledIncludeNode
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CompiledTemplateprivate Serializableprivate ParserContextprivate Serializableprivate long -
Constructor Summary
ConstructorsConstructorDescriptionCompiledIncludeNode(int begin, String name, char[] template, int start, int end, ParserContext context) -
Method Summary
Modifier and TypeMethodDescriptionbooleaneval(TemplateRuntime runtime, TemplateOutputStream appender, Object ctx, VariableResolverFactory factory) private static FileInputStreamopenInputStream(File file) Opens aFileInputStreamfor the specified file, else providing a detail error message than simply callingnew FileInputStream(file).private StringreadFile(TemplateRuntime runtime, String fileName, Object ctx, VariableResolverFactory factory) static StringreadInFile(TemplateRuntime runtime, File file) Methods inherited from class Node
calculateContents, getBegin, getCEnd, getContents, getCStart, getEnd, getLength, getName, getNext, getTerminus, isOpenNode, setBegin, setCEnd, setContents, setCStart, setEnd, setName, setNext, setTerminus
-
Field Details
-
cIncludeExpression
-
cPreExpression
-
fileDateStamp
private long fileDateStamp -
cFileCache
-
context
-
-
Constructor Details
-
CompiledIncludeNode
public CompiledIncludeNode(int begin, String name, char[] template, int start, int end, ParserContext context)
-
-
Method Details
-
eval
public Object eval(TemplateRuntime runtime, TemplateOutputStream appender, Object ctx, VariableResolverFactory factory) -
readFile
private String readFile(TemplateRuntime runtime, String fileName, Object ctx, VariableResolverFactory factory) -
demarcate
-
readInFile
-
openInputStream
Opens aFileInputStreamfor the specified file, else providing a detail error message than simply callingnew FileInputStream(file).An exception is thrown if
- the file parameter is null,
- the file does not exist,
- the file object exists but is a directory,
- the file exists but cannot be read.
- Parameters:
file- the file to open for input, can benull- Returns:
- a new
FileInputStreamfor the specified file - Throws:
FileNotFoundException- if the file is null or does not existIOException- if the file object is a directory or cannot be read
-