CollectingByteOutputReceiver
public
class
CollectingByteOutputReceiver
extends Object
implements
IShellOutputReceiver
| java.lang.Object | |
| ↳ | com.android.tradefed.device.CollectingByteOutputReceiver |
一个 IShellOutputReceiver,用于将整个 shell 输出收集到 byte[] 中。
这对于会产生大量输出的 shell 命令非常有用,因为 2 倍的 String 内存开销会非常大。
摘要
公共构造函数 | |
|---|---|
CollectingByteOutputReceiver()
|
|
公共方法 | |
|---|---|
void
|
addOutput(byte[] data, int offset, int length)
每次有新数据可用时都会调用。 |
void
|
cancel()
取消输出集合 |
void
|
clear()
尝试取消引用所有可以取消引用的内容 |
void
|
flush()
在进程执行结束时调用(除非进程被取消)。 |
byte[]
|
getOutput()
|
boolean
|
isCancelled()
用于停止执行远程 shell 命令的取消方法。 |
公共构造函数
CollectingByteOutputReceiver
public CollectingByteOutputReceiver ()
公共方法
addOutput
public void addOutput (byte[] data,
int offset,
int length)每次有新数据可用时调用。
| 参数 | |
|---|---|
data |
byte:新数据。 |
offset |
int:新数据的起始偏移量。 |
length |
int:新数据的长度。 |
取消
public void cancel ()
取消输出集合
清除
public void clear ()
尝试取消引用所有可以取消引用的内容
flush
public void flush ()
在进程执行结束时调用(除非进程被取消)。这允许接收方终止并刷新尚未处理的任何数据。
getOutput
public byte[] getOutput ()
| 返回 | |
|---|---|
byte[] |
|
isCancelled
public boolean isCancelled ()
用于停止执行远程 shell 命令的取消方法。
| 返回 | |
|---|---|
boolean |
如果为 true,则取消命令的执行。 |