public interface GenericInterpreter
Modifier and Type | Method and Description |
---|---|
Object |
eval(Reader reader)
Same as
eval(String) except that the source of the script
is provided as a Reader |
Object |
eval(String script)
Executes the specified script.
|
Object |
get(String key)
Retrieves a value set in the state of this engine.
|
Writer |
getErrorWriter()
Returns the
Writer used to display error output. |
Reader |
getReader()
Returns a
Reader to be used by the script to read input. |
Writer |
getWriter()
Returns the
Writer for scripts to use when displaying
output. |
void |
put(String key,
Object value)
Sets a key/value pair in the state of the ScriptEngine that may either
create a Java Language Binding to be used in the execution of scripts or
be used in some other way, depending on whether the key is reserved.
|
void |
setErrorWriter(Writer writer)
Sets the
Writer used to display error output. |
void |
setReader(Reader reader)
Sets the
Reader for scripts to read input . |
void |
setWriter(Writer writer)
Sets the
Writer for scripts to use when displaying output. |
Object eval(String script) throws ScriptException
ScriptContext
for the ScriptEngine
is used.script
- The script language source to be executed.ScriptException
- if error occurrs in script.NullPointerException
- if the argument is null.Object eval(Reader reader) throws ScriptException
eval(String)
except that the source of the script
is provided as a Reader
reader
- The source of the script.ScriptException
- if an error occurrs in script.NullPointerException
- if the argument is null.void put(String key, Object value)
getBindings(ScriptContext.ENGINE_SCOPE).put
.key
- The name of named value to addvalue
- The value of named value to add.NullPointerException
- if key is null.IllegalArgumentException
- if key is empty.Object get(String key)
setValue
or some other value in the
state of the ScriptEngine
, depending on the
implementation. Must have the same effect as
getBindings(ScriptContext.ENGINE_SCOPE).get
key
- The key whose value is to be returnedNullPointerException
- if key is null.IllegalArgumentException
- if key is empty.Writer getWriter()
Writer
for scripts to use when displaying
output.Writer
.Writer getErrorWriter()
Writer
used to display error output.Writer
void setWriter(Writer writer)
Writer
for scripts to use when displaying output.writer
- The new Writer
.void setErrorWriter(Writer writer)
Writer
used to display error output.writer
- The Writer
.Reader getReader()
Reader
to be used by the script to read input.Reader
.void setReader(Reader reader)
Reader
for scripts to read input .reader
- The new Reader
.Copyright © 2007–2017 Artenum. All rights reserved.