public class CommandSessionImpl extends Object implements CommandSession, Converter
| Modifier and Type | Field and Description |
|---|---|
static String |
COMMANDS |
protected InputStream |
in |
protected PrintStream |
out |
static String |
SESSION_CLOSED |
protected Map<String,Object> |
variables |
static String |
VARIABLES |
CONVERTER_CLASSES, INSPECT, LINE, PART| Modifier | Constructor and Description |
|---|---|
protected |
CommandSessionImpl(CommandProcessorImpl shell,
InputStream in,
PrintStream out,
PrintStream err) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close this command session.
|
Object |
convert(Class<?> desiredType,
Object in)
Convert an object to another type.
|
Object |
execute(CharSequence commandline)
Execute a program in this session.
|
Object |
expr(CharSequence expr) |
CharSequence |
format(Object result,
int inspect)
Convert an object to string form (CharSequence).
|
CharSequence |
format(Object target,
int level,
Converter escape)
Convert an objet to a CharSequence object in the requested format.
|
Object |
get(String name)
Get the value of a variable.
|
PrintStream |
getConsole()
Return the PrintStream for the console.
|
InputStream |
getKeyboard()
Return the input stream that is the first of the pipeline.
|
void |
put(String name,
Object value)
Set the value of a variable.
|
public static final String SESSION_CLOSED
public static final String VARIABLES
public static final String COMMANDS
protected InputStream in
protected PrintStream out
protected CommandSessionImpl(CommandProcessorImpl shell, InputStream in, PrintStream out, PrintStream err)
public void close()
CommandSessionclose in interface CommandSessionpublic Object execute(CharSequence commandline) throws Exception
CommandSessionexecute in interface CommandSessionExceptionpublic InputStream getKeyboard()
CommandSessiongetKeyboard in interface CommandSessionpublic Object get(String name)
CommandSessionget in interface CommandSessionpublic void put(String name, Object value)
CommandSessionput in interface CommandSessionname - Name of the variable.value - Value of the variablepublic PrintStream getConsole()
CommandSessiongetConsole in interface CommandSessionpublic CharSequence format(Object target, int level, Converter escape) throws Exception
Converterpublic Object convert(Class<?> desiredType, Object in)
CommandSessionconvert in interface CommandSessionconvert in interface ConverterdesiredType - The type that the returned object can be assigned toin - The object that must be convertedpublic CharSequence format(Object result, int inspect)
CommandSessionformat in interface CommandSessionpublic Object expr(CharSequence expr)
Copyright © 2015. All rights reserved.