設備文件報告器

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 ( patterns) addPatterns ( patterns)

新增具有對應日誌資料類型的模式

void addPatterns (String... patterns)

新增模式並將日誌資料類型設為預設值。

run ()

實際上在檔案系統中搜尋指定的模式,如果找到則將它們傳送到ITestInvocationListener#testLog

void setDefaultLogDataType ( LogDataType type)

為沒有關聯類型的模式設定預設日誌資料類型集。

void setInferUnknownDataTypes (boolean infer)

要或不要嘗試透過根據清單檢查檔案副檔名來推斷UNKNOWN檔案的資料類型。

void setSkipRepeatFiles (boolean skip)

是否跳過已經上報的文件。

公共構造函數

設備文件報告器

public DeviceFileReporter (ITestDevice device, 
                ITestInvocationListener listener)

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

參數
device ITestDevice

listener ITestInvocationListener

公共方法

新增模式

public void addPatterns ( patterns)

新增具有對應日誌資料類型的模式

參數
patternsString檔名 glob 模式到其各自LogDataTypeERROR(/Map) 。全局應該是絕對的。

新增模式

public void addPatterns (String... patterns)

新增模式並將日誌資料類型設為預設值。

參數
patterns StringString檔名全域模式的可變參數陣列。應該是絕對的。

跑步

public  run ()

實際上在檔案系統中搜尋指定的模式,如果找到則將它們傳送到ITestInvocationListener#testLog

退貨

投擲
DeviceNotAvailableException

設定預設日誌資料類型

public void setDefaultLogDataType (LogDataType type)

為沒有關聯類型的模式設定預設日誌資料類型集。

參數
type LogDataTypeLogDataType

也可以看看:

設定推斷未知資料類型

public void setInferUnknownDataTypes (boolean infer)

要或不要嘗試透過根據清單檢查檔案副檔名來推斷UNKNOWN檔案的資料類型。

請注意,啟用後,這些推斷將僅針對檔案類型UNKNOWN模式(包括在沒有特定類型的情況下新增的模式,並且沒有手動設定預設類型)。如果推理失敗,資料類型將保持為UNKNOWN

參數
infer boolean

設定跳過重複文件

public void setSkipRepeatFiles (boolean skip)

是否跳過已經上報的文件。僅當使用多個模式並且其中兩個或多個模式與同一文件相符時,這才相關。

請注意,這必須只在調用run()之前調用。否則會導致未定義的行為。

參數
skip boolean