Package org.mvel2.templates.res
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 CompiledTemplate
private Serializable
private ParserContext
private Serializable
private long
-
Constructor Summary
ConstructorsConstructorDescriptionCompiledIncludeNode
(int begin, String name, char[] template, int start, int end, ParserContext context) -
Method Summary
Modifier and TypeMethodDescriptionboolean
eval
(TemplateRuntime runtime, TemplateOutputStream appender, Object ctx, VariableResolverFactory factory) private static FileInputStream
openInputStream
(File file) Opens aFileInputStream
for the specified file, else providing a detail error message than simply callingnew FileInputStream(file)
.private String
readFile
(TemplateRuntime runtime, String fileName, Object ctx, VariableResolverFactory factory) static String
readInFile
(TemplateRuntime runtime, File file) Methods inherited from class org.mvel2.templates.res.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 aFileInputStream
for 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
FileInputStream
for 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
-