Example usage for org.apache.hadoop.fs FileStatus FileStatus

List of usage examples for org.apache.hadoop.fs FileStatus FileStatus

Introduction

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

Prototype

public FileStatus(long length, boolean isdir, int block_replication, long blocksize, long modification_time,
        long access_time, FsPermission permission, String owner, String group, Path path) 

Source Link

Document

Constructor for file systems on which symbolic links are not supported

Usage

From source file:tachyon.hadoop.AbstractTFS.java

License:Apache License

@Override
public FileStatus[] listStatus(Path path) throws IOException {
    TachyonURI tPath = new TachyonURI(Utils.getPathWithoutScheme(path));
    Path hdfsPath = Utils.getHDFSPath(tPath, mUnderFSAddress);
    LOG.info("listStatus(" + path + "): HDFS Path: " + hdfsPath);

    if (mStatistics != null) {
        mStatistics.incrementReadOps(1);
    }//ww w.  j  a va  2s .c o  m

    fromHdfsToTachyon(tPath);
    if (!mTFS.exist(tPath)) {
        throw new FileNotFoundException("File does not exist: " + path);
    }

    List<FileInfo> files = mTFS.listStatus(tPath);
    FileStatus[] ret = new FileStatus[files.size()];
    for (int k = 0; k < files.size(); k++) {
        FileInfo info = files.get(k);
        // TODO(hy): Replicate 3 with the number of disk replications.
        ret[k] = new FileStatus(info.getLength(), info.isFolder, 3, info.getBlockSizeBytes(),
                info.getCreationTimeMs(), info.getCreationTimeMs(), null, null, null,
                new Path(mTachyonHeader + info.getPath()));
    }
    return ret;
}