CollectingOutputReceiver

public class CollectingOutputReceiver
extends Object implements IShellOutputReceiver

java.lang.Object
   ↳ com.android.ddmlib.CollectingOutputReceiver


IShellOutputReceiver,可將整個殼層輸出內容收集到一個 String 中。

摘要

公用建構函式

CollectingOutputReceiver()
CollectingOutputReceiver(CountDownLatch commandCompleteLatch)

公用方法

void addOutput(byte[] data, int offset, int length)

每當有新資料時,系統就會呼叫這個函式。

boolean awaitCompletion(long timeout, TimeUnit unit)
void cancel()

取消輸出集合。

void flush()

在程序執行結束時呼叫 (除非程序已取消)。

String getOutput()
boolean isCancelled()

Cancel 方法可停止執行遠端 shell 命令。

boolean isComplete()

公用建構函式

CollectingOutputReceiver

public CollectingOutputReceiver ()

CollectingOutputReceiver

public CollectingOutputReceiver (CountDownLatch commandCompleteLatch)

參數
commandCompleteLatch CountDownLatch

公用方法

addOutput

public void addOutput (byte[] data, 
                int offset, 
                int length)

每當有新資料時,系統就會呼叫這個函式。

參數
data byte:新資料。

offset int:新資料的起始位移。

length int:新資料的長度。

awaitCompletion

public boolean awaitCompletion (long timeout, 
                TimeUnit unit)

參數
timeout long

unit TimeUnit

傳回
boolean

擲回
InterruptedException

取消

public void cancel ()

取消輸出集合。

flush

public void flush ()

在程序執行結束時呼叫 (除非程序已取消)。這可讓接收端終止並清除尚未處理的資料。

getOutput

public String getOutput ()

傳回
String

isCancelled

public boolean isCancelled ()

取消方法,用於停止執行遠端 shell 指令。

傳回
boolean true 可取消執行指令。

isComplete

public boolean isComplete ()

傳回
boolean