类 CommandSessionImpl
- java.lang.Object
-
- org.apache.felix.gogo.runtime.CommandSessionImpl
-
- 所有已实现的接口:
CommandSession
,Converter
public class CommandSessionImpl extends java.lang.Object implements CommandSession, Converter
-
-
字段概要
字段 修饰符和类型 字段 说明 static java.lang.String
COMMANDS
protected java.io.InputStream
in
protected java.io.PrintStream
out
static java.lang.String
SESSION_CLOSED
protected java.util.Map<java.lang.String,java.lang.Object>
variables
static java.lang.String
VARIABLES
-
从接口继承的字段 org.apache.felix.service.command.Converter
CONVERTER_CLASSES, INSPECT, LINE, PART
-
-
构造器概要
构造器 限定符 构造器 说明 protected
CommandSessionImpl(CommandProcessorImpl shell, java.io.InputStream in, java.io.PrintStream out, java.io.PrintStream err)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
close()
Close this command session.java.lang.Object
convert(java.lang.Class<?> desiredType, java.lang.Object in)
Convert an object to another type.java.lang.Object
execute(java.lang.CharSequence commandline)
Execute a program in this session.java.lang.Object
expr(java.lang.CharSequence expr)
java.lang.CharSequence
format(java.lang.Object result, int inspect)
Convert an object to string form (CharSequence).java.lang.CharSequence
format(java.lang.Object target, int level, Converter escape)
Convert an objet to a CharSequence object in the requested format.java.lang.Object
get(java.lang.String name)
Get the value of a variable.java.io.PrintStream
getConsole()
Return the PrintStream for the console.java.io.InputStream
getKeyboard()
Return the input stream that is the first of the pipeline.void
put(java.lang.String name, java.lang.Object value)
Set the value of a variable.
-
-
-
字段详细资料
-
SESSION_CLOSED
public static final java.lang.String SESSION_CLOSED
- 另请参阅:
- 常量字段值
-
VARIABLES
public static final java.lang.String VARIABLES
- 另请参阅:
- 常量字段值
-
COMMANDS
public static final java.lang.String COMMANDS
- 另请参阅:
- 常量字段值
-
in
protected java.io.InputStream in
-
out
protected java.io.PrintStream out
-
variables
protected final java.util.Map<java.lang.String,java.lang.Object> variables
-
-
构造器详细资料
-
CommandSessionImpl
protected CommandSessionImpl(CommandProcessorImpl shell, java.io.InputStream in, java.io.PrintStream out, java.io.PrintStream err)
-
-
方法详细资料
-
close
public void close()
从接口复制的说明:CommandSession
Close this command session. After the session is closed, it will throw IllegalStateException when it is used.- 指定者:
close
在接口中CommandSession
-
execute
public java.lang.Object execute(java.lang.CharSequence commandline) throws java.lang.Exception
从接口复制的说明:CommandSession
Execute a program in this session.- 指定者:
execute
在接口中CommandSession
- 返回:
- the result of the execution
- 抛出:
java.lang.Exception
-
getKeyboard
public java.io.InputStream getKeyboard()
从接口复制的说明:CommandSession
Return the input stream that is the first of the pipeline. This stream is sometimes necessary to communicate directly to the end user. For example, a "less" or "more" command needs direct input from the keyboard to control the paging.- 指定者:
getKeyboard
在接口中CommandSession
- 返回:
- InpuStream used closest to the user or null if input is from a file.
-
get
public java.lang.Object get(java.lang.String name)
从接口复制的说明:CommandSession
Get the value of a variable.- 指定者:
get
在接口中CommandSession
- 返回:
-
put
public void put(java.lang.String name, java.lang.Object value)
从接口复制的说明:CommandSession
Set the value of a variable.- 指定者:
put
在接口中CommandSession
- 参数:
name
- Name of the variable.value
- Value of the variable
-
getConsole
public java.io.PrintStream getConsole()
从接口复制的说明:CommandSession
Return the PrintStream for the console. This must always be the stream "closest" to the user. This stream can be used to post messages that bypass the piping. If the output is piped to a file, then the object returned must be null.- 指定者:
getConsole
在接口中CommandSession
- 返回:
-
format
public java.lang.CharSequence format(java.lang.Object target, int level, Converter escape) throws java.lang.Exception
从接口复制的说明:Converter
Convert an objet to a CharSequence object in the requested format. The format can be INSPECT, LINE, or PART. Other values must throw IllegalArgumentException.
-
convert
public java.lang.Object convert(java.lang.Class<?> desiredType, java.lang.Object in)
从接口复制的说明:CommandSession
Convert an object to another type.- 指定者:
convert
在接口中CommandSession
- 指定者:
convert
在接口中Converter
- 参数:
desiredType
- The type that the returned object can be assigned toin
- The object that must be converted- 返回:
- An object that can be assigned to the desired type or null.
-
format
public java.lang.CharSequence format(java.lang.Object result, int inspect)
从接口复制的说明:CommandSession
Convert an object to string form (CharSequence). The level is defined in the Converter interface, it can be one of INSPECT, LINE, PART. This function always returns a non null value. As a last resort, toString is called on the Object.- 指定者:
format
在接口中CommandSession
- 返回:
-
expr
public java.lang.Object expr(java.lang.CharSequence expr)
-
-