Example usage for org.apache.hadoop.hdfs.protocol HdfsFileStatus isDir

List of usage examples for org.apache.hadoop.hdfs.protocol HdfsFileStatus isDir

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.protocol HdfsFileStatus isDir.

Prototype

boolean isDir();

Source Link

Document

See FileStatus#isDir() .

Usage

From source file:com.bigstep.datalake.DLFileSystem.java

License:Apache License

private FileStatus makeQualified(HdfsFileStatus f, Path parent) {

    return new FileStatus(f.getLen(), f.isDir(), f.getReplication(), f.getBlockSize(), f.getModificationTime(),
            f.getAccessTime(), f.getPermission(), f.getOwner(), f.getGroup(),
            f.isSymlink() ? new Path(f.getSymlink()) : null,
            makeQualified(f.getFullPath(parent).makeQualified(getUri(), getWorkingDirectory())));
}

From source file:com.pinterest.terrapin.controller.HdfsManagerTest.java

License:Apache License

private HdfsFileStatus buildHdfsStatus(String path, Boolean isDir, Long modificationTime) {
    HdfsFileStatus status = buildHdfsStatus(path);
    if (isDir != null) {
        when(status.isDir()).thenReturn(isDir);
    }// w  w w  . j a v  a  2s.  c o  m
    if (modificationTime != null) {
        when(status.getModificationTime()).thenReturn(modificationTime);
    }
    return status;
}

From source file:org.opencloudengine.flamingo.mapreduce.util.HdfsUtils.java

License:Apache License

/**
 *   ?? ?./*from   w w w .  ja v a 2  s. c  om*/
 *
 * @param client DFS Client
 * @param path   
 * @return ??  <tt>true</tt>
 * @throws java.io.IOException HDFS IO    
 */
public static boolean isFile(DFSClient client, String path) throws IOException {
    HdfsFileStatus status = client.getFileInfo(path);
    return !status.isDir();
}

From source file:org.opencloudengine.flamingo.mapreduce.util.HdfsUtils.java

License:Apache License

/**
 *  ? ??  ?.// w  w  w . j  a v  a2 s  . c o m
 *
 * @param hdfsUrl HDFS URL
 * @param path      ?  
 * @return  <tt>true</tt>
 * @throws java.io.IOException ?     , HDFS?    
 */
public static boolean isExist(String hdfsUrl, String path) throws IOException {
    DFSClient client = HdfsUtils.createDFSClient(hdfsUrl);
    HdfsFileStatus status = client.getFileInfo(path);
    if (status != null && !status.isDir()) {
        client.close();
        return true;
    }
    client.close();
    return false;
}