目标文件实用程序

public class TargetFileUtils
extends Object

java.lang.Object
com.android.tradefed.util.TargetFileUtils


概括

公共构造函数

TargetFileUtils ()

公共方法

static findFile (String path, String namePattern, options, ITestDevice device) findFile (String path, String namePattern, options, ITestDevice device)

执行 adb shell find 命令并将结果作为ERROR(/ArrayList ) ERROR(/ArrayList )

static String getPermission (String filepath, ITestDevice device)

读取路径的文件权限位。

static boolean hasPermission ( TargetFileUtils.FilePermission permission, String permissionBits)

确定权限位是否向任何组授予指定权限。

static boolean isReadOnly (String filepath, ITestDevice device)

检查给定路径的权限是否为只读。

static boolean isReadWriteOnly (String filepath, ITestDevice device)

检查给定路径的权限是否为读写。

公共构造函数

目标文件实用程序

public TargetFileUtils ()

公共方法

查找文件

public static  findFile (String path, 
                String namePattern, 
                 options, 
                ITestDevice device)

执行 adb shell find 命令并将结果作为ERROR(/ArrayList ) ERROR(/ArrayList )

参数
path String : 在设备上搜索的路径。

namePattern String :文件名模式。

options :其他选项传递查找的String ERROR(/List)

device ITestDevice :测试设备。

退货
结果为ERROR(/ArrayList ) ERROR(/ArrayList )

投掷
DeviceNotAvailableException如果与设备的连接丢失且无法恢复。

获得许可

public static String getPermission (String filepath, 
                ITestDevice device)

读取路径的文件权限位。

参数
filepath String :文件或目录的路径。

device ITestDevice :测试设备。

退货
String路径的八进制权限位。

投掷
DeviceNotAvailableException

有权限

public static boolean hasPermission (TargetFileUtils.FilePermission permission, 
                String permissionBits)

确定权限位是否向任何组授予指定权限。

参数
permission TargetFileUtils.FilePermission :指定权限。

permissionBits String :八进制权限字符串(例如 741)。

退货
boolean如果任何所有者/组/全局具有指定权限,则为 True。

是只读的

public static boolean isReadOnly (String filepath, 
                ITestDevice device)

检查给定路径的权限是否为只读。

参数
filepath String :文件或目录的路径。

device ITestDevice :测试设备。

退货
boolean如果路径是只读的,则为 true,否则为 false。

投掷
DeviceNotAvailableException

只读

public static boolean isReadWriteOnly (String filepath, 
                ITestDevice device)

检查给定路径的权限是否为读写。

参数
filepath String :文件或目录的路径。

device ITestDevice :测试设备。

退货
boolean如果路径可读写,则为 true,否则为 false。

投掷
DeviceNotAvailableException