to top
public class

DeviceFileReporter

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

Class Overview

A utility class that checks the device for files and sends them to 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(List<String> patterns)
Add patterns with the log data type set to the default.
void addPatterns(Map<String, LogDataType> patterns)
Add patterns with the respective log data types
void addPatterns(String... patterns)
Add patterns with the log data type set to the default.
List<String> run()
Actually search the filesystem for the specified patterns and send them to testLog(String, LogDataType, InputStreamSource) 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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public DeviceFileReporter (ITestDevice device, ITestInvocationListener listener)

Initialize a new DeviceFileReporter with the provided ITestDevice

Public Methods

public void addPatterns (List<String> patterns)

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

Parameters
patterns a List of String filename glob patterns. Should be absolute.

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

Add patterns with the respective log data types

Parameters
patterns a Map of String filename glob patterns to their respective LogDataTypes. The globs should be absolute.

public void addPatterns (String... patterns)

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

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

public List<String> run ()

Actually search the filesystem for the specified patterns and send them to testLog(String, LogDataType, InputStreamSource) if found

public void setDefaultLogDataType (LogDataType type)

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

Parameters
type the LogDataType

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.

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 . Doing otherwise will cause undefined behavior.

See Also