DeviceFileReporter

public class DeviceFileReporter
extends Object

java.lang.Object
   ↳ com.android.tradefed.result.DeviceFileReporter


這個公用程式類別會檢查裝置是否有檔案,並在找到檔案時傳送至 ITestInvocationListener.testLog(String,LogDataType,InputStreamSource)

摘要

公用建構函式

DeviceFileReporter(ITestDevice device, ITestInvocationListener listener)

使用提供的 ITestDevice 初始化新的 DeviceFileReporter

公用方法

void addPatterns(Map<String, LogDataType> patterns)

新增模式和對應的記錄資料類型

void addPatterns(List<String> patterns)

新增模式,並將記錄檔資料類型設為預設值。

void addPatterns(String... patterns)

新增模式,並將記錄檔資料類型設為預設值。

List<String> run()

實際在檔案系統中搜尋指定模式,並在找到時傳送至 ITestInvocationListener.testLog

void setDefaultLogDataType(LogDataType type)

為沒有相關聯類型的模式設定預設記錄資料類型集。

void setInferUnknownDataTypes(boolean infer)

是否嘗試透過比對檔案副檔名與清單,推斷 UNKNOWN 檔案的資料類型。

void setSkipRepeatFiles(boolean skip)

是否要略過已回報的檔案。

公用建構函式

DeviceFileReporter

public DeviceFileReporter (ITestDevice device, 
                ITestInvocationListener listener)

使用提供的 ITestDevice 初始化新的 DeviceFileReporter。

參數
device ITestDevice

listener ITestInvocationListener

公用方法

addPatterns

public void addPatterns (Map<String, LogDataType> patterns)

新增模式和對應的記錄資料類型

參數
patterns Map:將 Map 檔案名稱 glob 模式對應至各自的 LogDataTypeStringglob 應為絕對路徑。

addPatterns

public void addPatterns (List<String> patterns)

新增模式,並將記錄檔資料類型設為預設值。

參數
patterns ListListString 檔案名稱 glob 模式。必須是絕對路徑。

addPatterns

public void addPatterns (String... patterns)

新增模式,並將記錄檔資料類型設為預設值。

參數
patterns StringString 檔案名稱 glob 模式的 varargs 陣列。必須是絕對路徑。

得分

public List<String> run ()

實際在檔案系統中搜尋指定的模式,並在找到時傳送至 ITestInvocationListener.testLog

傳回
List<String>

擲回
DeviceNotAvailableException

setDefaultLogDataType

public void setDefaultLogDataType (LogDataType type)

為沒有相關聯類型的模式設定預設記錄資料類型集。

參數
type LogDataTypeLogDataType

另請參閱:

setInferUnknownDataTypes

public void setInferUnknownDataTypes (boolean infer)

是否要嘗試透過比對檔案副檔名與清單,推斷 UNKNOWN 檔案的資料類型。

請注意,啟用後,系統只會針對檔案類型為 UNKNOWN 的模式進行推論 (包括新增模式時未指定類型,且未手動設定預設類型)。如果推測失敗,資料類型會維持 UNKNOWN

參數
infer boolean

setSkipRepeatFiles

public void setSkipRepeatFiles (boolean skip)

是否要略過已回報的檔案。只有在使用多個模式,且其中兩個以上的模式與相同檔案相符時,這項設定才適用。

請注意,只能在呼叫 run() 之前呼叫此函式。否則會導致未定義的行為。

參數
skip boolean