CollectingByteOutputReceiver
public
class
CollectingByteOutputReceiver
extends Object
implements
IShellOutputReceiver
| java.lang.Object | |
| ↳ | com.android.tradefed.device.CollectingByteOutputReceiver |
IShellOutputReceiver,可將整個殼層輸出內容收集到 byte[] 中。
如果殼層指令會產生大量輸出內容,2 倍的 String 記憶體負擔就會相當可觀,這時就適合使用這項功能。
摘要
公用建構函式 | |
|---|---|
CollectingByteOutputReceiver()
|
|
公用方法 | |
|---|---|
void
|
addOutput(byte[] data, int offset, int length)
每當有新資料可用時,系統就會呼叫此方法。 |
void
|
cancel()
取消收集輸出內容 |
void
|
clear()
Try to unref everything that we can |
void
|
flush()
在程序執行結束時呼叫 (除非程序已取消)。 |
byte[]
|
getOutput()
|
boolean
|
isCancelled()
Cancel 方法可停止執行遠端 shell 命令。 |
公用建構函式
CollectingByteOutputReceiver
public CollectingByteOutputReceiver ()
公用方法
addOutput
public void addOutput (byte[] data,
int offset,
int length)每當有新資料可用時,系統就會呼叫此方法。
| 參數 | |
|---|---|
data |
byte:新資料。 |
offset |
int:新資料的起始位移。 |
length |
int:新資料的長度。 |
cancel
public void cancel ()
取消輸出集合
清除
public void clear ()
Try to unref everything that we can
清除
public void flush ()
在程序執行結束時呼叫 (除非程序已取消)。這可讓接收端終止並清除尚未處理的資料。
getOutput
public byte[] getOutput ()
| 傳回 | |
|---|---|
byte[] |
|
isCancelled
public boolean isCancelled ()
取消方法,停止執行遠端 Shell 指令。
| 傳回 | |
|---|---|
boolean |
true 可取消執行指令。 |