DeviceFileReporter

public class DeviceFileReporter
extends Object

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


A utility class that checks the device for files and sends them to ITestInvocationListener#testLog(String, LogDataType, InputStreamSource) if found.

Summary

Public constructors

DeviceFileReporter(ITestDevice device, ITestInvocationListener listener)

Initialize a new DeviceFileReporter with the provided ITestDevice

Public methods

void addPatterns( patterns)

Add patterns with the respective log data types

void addPatterns(String... patterns)

Add patterns with the log data type set to the default.

run()

Actually search the filesystem for the specified patterns and send them to ITestInvocationListener#testLog if found

void setDefaultLogDataType(LogDataType type)

Set the default log data type set for patterns that don't have an associated type.

void setInferUnknownDataTypes(boolean infer)

Whether to attempt to infer the data types of UNKNOWN files by checking the file extensions against a list.

void setSkipRepeatFiles(boolean skip)

Whether or not to skip files which have already been reported.

Public constructors

DeviceFileReporter

public DeviceFileReporter (ITestDevice device, 
                ITestInvocationListener listener)

Initialize a new DeviceFileReporter with the provided ITestDevice

Parameters
device ITestDevice

listener ITestInvocationListener

Public methods

addPatterns

public void addPatterns ( patterns)

Add patterns with the respective log data types

Parameters
patterns : a ERROR(/Map) of String filename glob patterns to their respective LogDataTypes. The globs should be absolute.

addPatterns

public void addPatterns (String... patterns)

Add patterns with the log data type set to the default.

Parameters
patterns String: a varargs array of String filename glob patterns. Should be absolute.

run

public  run ()

Actually search the filesystem for the specified patterns and send them to ITestInvocationListener#testLog if found

Returns

Throws
DeviceNotAvailableException

setDefaultLogDataType

public void setDefaultLogDataType (LogDataType type)

Set the default log data type set for patterns that don't have an associated type.

Parameters
type LogDataType: the LogDataType

setInferUnknownDataTypes

public void setInferUnknownDataTypes (boolean infer)

Whether to attempt to infer the data types of UNKNOWN files by checking the file extensions against a list.

Note that, when enabled, these inferences will only be made for patterns with file type UNKNOWN (which includes patterns added without a specific type, and without the) default type having been set manually). If the inference fails, the data type will remain as UNKNOWN.

Parameters
infer boolean

setSkipRepeatFiles

public void setSkipRepeatFiles (boolean skip)

Whether or not to skip files which have already been reported. This is only relevant when multiple patterns are being used, and two or more of those patterns match the same file.

Note that this must only be called prior to calling run(). Doing otherwise will cause undefined behavior.

Parameters
skip boolean