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.
|
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()
CommandSession
close
in interface CommandSession
public Object execute(CharSequence commandline) throws Exception
CommandSession
execute
in interface CommandSession
Exception
public InputStream getKeyboard()
CommandSession
getKeyboard
in interface CommandSession
public Object get(String name)
CommandSession
get
in interface CommandSession
public void put(String name, Object value)
CommandSession
put
in interface CommandSession
name
- Name of the variable.value
- Value of the variablepublic PrintStream getConsole()
CommandSession
getConsole
in interface CommandSession
public CharSequence format(Object target, int level, Converter escape) throws Exception
Converter
public Object convert(Class<?> desiredType, Object in)
CommandSession
convert
in interface CommandSession
convert
in interface Converter
desiredType
- The type that the returned object can be assigned toin
- The object that must be convertedpublic CharSequence format(Object result, int inspect)
CommandSession
format
in interface CommandSession
Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.