TargetFileUtils
public
class
TargetFileUtils
extends Object
java.lang.Object | |
↳ | com.android.tradefed.util.TargetFileUtils |
Summary
Public constructors | |
---|---|
TargetFileUtils()
|
Public methods | |
---|---|
static
|
findFile(String path, String namePattern,
Helper method which executes a adb shell find command and returns the results as an |
static
String
|
getPermission(String filepath, ITestDevice device)
Read the file permission bits of a path. |
static
boolean
|
hasPermission(TargetFileUtils.FilePermission permission, String permissionBits)
Determines if the permission bits grant the specify permission to any group. |
static
boolean
|
isReadOnly(String filepath, ITestDevice device)
Check if the permission for a given path is readonly. |
static
boolean
|
isReadWriteOnly(String filepath, ITestDevice device)
Check if the permission for a given path is readwrite. |
Public constructors
TargetFileUtils
public TargetFileUtils ()
Public methods
findFile
public staticfindFile (String path, String namePattern, options, ITestDevice device)
Helper method which executes a adb shell find command and returns the results as an ERROR(/ArrayList
.
Parameters | |
---|---|
path |
String : The path to search on device. |
namePattern |
String : The file name pattern. |
options |
: A ERROR(/List) of String for other options pass to find. |
device |
ITestDevice : The test device. |
Returns | |
---|---|
|
The result in ERROR(/ArrayList . |
Throws | |
---|---|
DeviceNotAvailableException |
if connection with device is lost and cannot be recovered. |
getPermission
public static String getPermission (String filepath, ITestDevice device)
Read the file permission bits of a path.
Parameters | |
---|---|
filepath |
String : Path to a file or directory. |
device |
ITestDevice : The test device. |
Returns | |
---|---|
String |
Octal permission bits for the path. |
Throws | |
---|---|
DeviceNotAvailableException |
hasPermission
public static boolean hasPermission (TargetFileUtils.FilePermission permission, String permissionBits)
Determines if the permission bits grant the specify permission to any group.
Parameters | |
---|---|
permission |
TargetFileUtils.FilePermission : The specify permissions. |
permissionBits |
String : The octal permissions string (e.g. 741). |
Returns | |
---|---|
boolean |
True if any owner/group/global has the specify permission. |
isReadOnly
public static boolean isReadOnly (String filepath, ITestDevice device)
Check if the permission for a given path is readonly.
Parameters | |
---|---|
filepath |
String : Path to a file or directory. |
device |
ITestDevice : The test device. |
Returns | |
---|---|
boolean |
true if the path is readonly, false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException |
isReadWriteOnly
public static boolean isReadWriteOnly (String filepath, ITestDevice device)
Check if the permission for a given path is readwrite.
Parameters | |
---|---|
filepath |
String : Path to a file or directory. |
device |
ITestDevice : The test device. |
Returns | |
---|---|
boolean |
true if the path is readwrite, false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException |