Example usage for org.apache.hadoop.fs FileUtil canExecute

List of usage examples for org.apache.hadoop.fs FileUtil canExecute

Introduction

In this page you can find the example usage for org.apache.hadoop.fs FileUtil canExecute.

Prototype

public static boolean canExecute(File f) 

Source Link

Document

Platform independent implementation for File#canExecute()

Usage

From source file:com.mellanox.r4h.MiniDFSCluster.java

License:Apache License

/**
 * @return a debug string which can help diagnose an error of why
 *         a given directory might have a permissions error in the context
 *         of a test case/*from  ww  w. j a  v  a2s  . c  o  m*/
 */
private String createPermissionsDiagnosisString(File path) {
    StringBuilder sb = new StringBuilder();
    while (path != null) {
        sb.append("path '" + path + "': ").append("\n");
        sb.append("\tabsolute:").append(path.getAbsolutePath()).append("\n");
        sb.append("\tpermissions: ");
        sb.append(path.isDirectory() ? "d" : "-");
        sb.append(FileUtil.canRead(path) ? "r" : "-");
        sb.append(FileUtil.canWrite(path) ? "w" : "-");
        sb.append(FileUtil.canExecute(path) ? "x" : "-");
        sb.append("\n");
        path = path.getParentFile();
    }
    return sb.toString();
}