本文整理匯總了Java中com.stericson.RootTools.RootTools.getFilePermissionsSymlinks方法的典型用法代碼示例。如果您正苦於以下問題:Java RootTools.getFilePermissionsSymlinks方法的具體用法?Java RootTools.getFilePermissionsSymlinks怎麽用?Java RootTools.getFilePermissionsSymlinks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.stericson.RootTools.RootTools
的用法示例。
在下文中一共展示了RootTools.getFilePermissionsSymlinks方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkUtil
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
* This will check a given binary, determine if it exists and determine that
* it has either the permissions 755, 775, or 777.
*
* @param util Name of the utility to check.
* @return boolean to indicate whether the binary is installed and has
* appropriate permissions.
*/
public boolean checkUtil(String util) {
List<String> foundPaths = RootShell.findBinary(util, true);
if (foundPaths.size() > 0) {
for (String path : foundPaths) {
Permissions permissions = RootTools
.getFilePermissionsSymlinks(path + "/" + util);
if (permissions != null) {
String permission;
if (Integer.toString(permissions.getPermissions()).length() > 3) {
permission = Integer.toString(permissions.getPermissions()).substring(1);
} else {
permission = Integer.toString(permissions.getPermissions());
}
if (permission.equals("755") || permission.equals("777")
|| permission.equals("775")) {
RootTools.utilPath = path + "/" + util;
return true;
}
}
}
}
return false;
}
示例2: checkUtil
import com.stericson.RootTools.RootTools; //導入方法依賴的package包/類
/**
* This will check a given binary, determine if it exists and determine that
* it has either the permissions 755, 775, or 777.
*
* @param util Name of the utility to check.
* @return boolean to indicate whether the binary is installed and has
* appropriate permissions.
*/
public boolean checkUtil(String util) {
if (RootTools.findBinary(util)) {
List<String> binaryPaths = new ArrayList<String>();
binaryPaths.addAll(RootTools.lastFoundBinaryPaths);
for (String path : binaryPaths) {
Permissions permissions = RootTools
.getFilePermissionsSymlinks(path + "/" + util);
if (permissions != null) {
String permission;
if (Integer.toString(permissions.getPermissions()).length() > 3)
permission = Integer.toString(permissions.getPermissions()).substring(1);
else
permission = Integer.toString(permissions.getPermissions());
if (permission.equals("755") || permission.equals("777")
|| permission.equals("775")) {
RootTools.utilPath = path + "/" + util;
return true;
}
}
}
}
return false;
}