@ThreadRestricted public final class JavaScriptIncluder extends Object
vo), with which to load modules. For example:
vo.inc( 'ABS-OR-REL-PATH/module.jsm' );
Script files must be encoded in UTF-8, or equivalently ASCII.
| Constructor and Description |
|---|
JavaScriptIncluder()
Constructs a JavaScriptIncluder with a default engine, and no initial script.
|
JavaScriptIncluder(File scriptFile)
Constructs a JavaScriptIncluder with a default engine.
|
JavaScriptIncluder(File scriptFile,
ScriptEngine _engine)
Constructs a JavaScriptIncluder with the specified engine.
|
| Modifier and Type | Method and Description |
|---|---|
ScriptEngine |
engine()
Returns the engine in which included modules are executed.
|
void |
inc(File file)
Includes a JavaScript file by executing it in the engine.
|
void |
inc(String path)
Includes a JavaScript file by executing it in the engine.
|
Object |
invokeKnownFunction(String name,
Object... args)
The same as (Invocable)engine().
|
File |
scriptFile()
The path to the first file that was executed by inclusion.
|
public JavaScriptIncluder() throws ScriptException
ScriptExceptionpublic JavaScriptIncluder(File scriptFile) throws IOException, ScriptException
scriptFile - to execute initially,
per scriptFile(); or null to execute noneIOExceptionScriptExceptionpublic JavaScriptIncluder(File scriptFile, ScriptEngine _engine) throws IOException, ScriptException
scriptFile - to execute initially,
per scriptFile(); or null to execute noneIOExceptionScriptExceptionpublic ScriptEngine engine()
public void inc(File file) throws IOException, ScriptException
file - the absolute path to the fileIOExceptionScriptExceptionpublic void inc(String path) throws IOException, ScriptException
path - the file's absolute or relative path,
per resolveFile(path)IOExceptionScriptExceptionpublic Object invokeKnownFunction(String name, Object... args) throws ScriptException
ScriptExceptionpublic File scriptFile()
inc(String),
inc(File)