设备文件报告器

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