|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.python.util.PythonInterpreter
org.python.util.InteractiveInterpreter
edu.wisc.ssec.mcidasv.jython.Interpreter
public class Interpreter
| Field Summary | |
|---|---|
private ConsoleCallback |
callback
A hook that allows external classes to respond to events. |
private static String |
CONSOLE_FILENAME
Dummy filename for the interactive interpreter. |
private boolean |
moreInput
Whether or not jython needs more input to run something. |
private ByteArrayOutputStream |
stderr
Stream used for error output. |
private ByteArrayOutputStream |
stdout
Stream used for normal output. |
private boolean |
thinking
Whether or not Jython is working on something |
| Fields inherited from class org.python.util.InteractiveInterpreter |
|---|
buffer, filename |
| Fields inherited from class org.python.util.PythonInterpreter |
|---|
cflags, systemState, threadLocals |
| Constructor Summary | |
|---|---|
Interpreter(org.python.core.PySystemState state,
ByteArrayOutputStream stdout,
ByteArrayOutputStream stderr)
Creates a Jython interpreter based upon the specified system state and whose output streams are mapped to the specified byte streams. |
|
| Method Summary | |
|---|---|
private static String |
clearStream(String command,
ByteArrayOutputStream stream)
Removes and returns all existing text from stream. |
void |
handleException(Console console,
Throwable e)
Sends error information to the specified console. |
void |
handleStreams(Console console,
String command)
Sends the contents of stdout and stderr on their
merry way. |
boolean |
isBusy()
Determines whether or not Jython is busy. |
boolean |
needMoreInput()
|
boolean |
push(Console console,
String line)
Here's the magic! |
protected void |
setCallbackHandler(ConsoleCallback newCallback)
Registers a new callback handler with the interpreter. |
| Methods inherited from class org.python.util.InteractiveInterpreter |
|---|
interrupt, resetbuffer, runcode, runsource, runsource, runsource, showexception, write |
| Methods inherited from class org.python.util.PythonInterpreter |
|---|
cleanup, compile, compile, compile, compile, eval, eval, exec, exec, execfile, execfile, execfile, get, get, getLocals, getSystemState, initialize, set, set, setErr, setErr, setErr, setIn, setIn, setIn, setLocals, setOut, setOut, setOut, setSystemState, threadLocalStateInterpreter |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final String CONSOLE_FILENAME
private ByteArrayOutputStream stderr
private ByteArrayOutputStream stdout
private boolean moreInput
private ConsoleCallback callback
private boolean thinking
| Constructor Detail |
|---|
public Interpreter(org.python.core.PySystemState state,
ByteArrayOutputStream stdout,
ByteArrayOutputStream stderr)
Additionally, the "__main__" module is imported by default so that the locals namespace makes sense.
state - The system state you want to use with the interpreter.stdout - The stream Jython will use for standard output.stderr - The stream Jython will use for error output.| Method Detail |
|---|
protected void setCallbackHandler(ConsoleCallback newCallback)
newCallback - The new callback handler.
public boolean push(Console console,
String line)
line - A Jython command.
public boolean isBusy()
true if busy, false otherwise.public boolean needMoreInput()
public void handleStreams(Console console,
String command)
stdout and stderr on their
merry way. Both streams are emptied as a result.
console - Console where the command originated.command - The command that was executed. Null values are permitted,
as they signify that no command was entered for any generated output.
private static String clearStream(String command,
ByteArrayOutputStream stream)
stream.
command - Command that was executed. Null values are permitted and
imply that no command is "associated" with text in
stream.stream - Stream to be cleared out.
stream before it was reset.handleStreams(Console, String)
public void handleException(Console console,
Throwable e)
console - The console that caused the exception.e - The exception!
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||