|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
edu.cmu.sphinx.util.CommandInterpreter
public class CommandInterpreter
This class is a command interpreter. It reads strings from an input stream, parses them into commands and executes them, results are sent back on the output stream.
CommandInterpreter| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary |
|---|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
CommandInterpreter()
Creates a command interpreter that won't read a stream. |
|
CommandInterpreter(java.io.BufferedReader in,
java.io.PrintWriter out)
Creates a command interpreter that reads/writes on the given streams. |
|
| Method Summary | |
|---|---|
void |
add(java.util.Map<java.lang.String,CommandInterface> newCommands)
Add the given set of commands to the list of commands. |
void |
add(java.lang.String name,
CommandInterface command)
Adds the given command to the command list. |
void |
addAlias(java.lang.String command,
java.lang.String alias)
Adds an alias to the command |
void |
close()
|
java.lang.String |
execute(java.lang.String cmdString)
Execute the given command string. |
java.io.PrintWriter |
getPrintWriter()
Returns the output stream of this CommandInterpreter. |
java.lang.String |
getPrompt()
Gets the prompt for the interpreter |
java.net.Socket |
getSocket()
Returns the Socket this CommandInterpreter uses. |
boolean |
load(java.lang.String filename)
|
static void |
main(java.lang.String[] args)
manual tester for the command interpreter. |
void |
putResponse(java.lang.String response)
Outputs a response to the sender. |
void |
run()
|
void |
setPrompt(java.lang.String prompt)
Sets the prompt for the interpreter |
void |
setSocket(java.net.Socket skt)
Sets the Socket for this CommandInterpreter. |
void |
setStreams(java.io.BufferedReader in,
java.io.PrintWriter out)
Sets the I/O streams |
void |
setTrace(boolean trace)
Sets the trace mode of the command interpreter. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CommandInterpreter(java.io.BufferedReader in,
java.io.PrintWriter out)
in - the input stream.out - the output stream.public CommandInterpreter()
| Method Detail |
|---|
public void setTrace(boolean trace)
trace - true if tracing.
public void setStreams(java.io.BufferedReader in,
java.io.PrintWriter out)
in - the input stream.out - the output stream.public java.net.Socket getSocket()
public void setSocket(java.net.Socket skt)
skt - the Socket this CommandInterpreter uses
public void add(java.lang.String name,
CommandInterface command)
name - the name of the command.command - the command to be executed.
public void addAlias(java.lang.String command,
java.lang.String alias)
command - the name of the command.alias - the new aliasepublic void add(java.util.Map<java.lang.String,CommandInterface> newCommands)
newCommands - the new commands to add to this interpreter.public void putResponse(java.lang.String response)
response - the response to send.public java.lang.String execute(java.lang.String cmdString)
cmdString - the command string.public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void close()
public boolean load(java.lang.String filename)
public void setPrompt(java.lang.String prompt)
prompt - the prompt.public java.lang.String getPrompt()
public java.io.PrintWriter getPrintWriter()
public static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||