Example usage for org.apache.hadoop.fs LocatedFileStatus setPath

List of usage examples for org.apache.hadoop.fs LocatedFileStatus setPath

Introduction

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

Prototype

public void setPath(final Path p) 

Source Link

Usage

From source file:de.zib.sfs.StatisticsFileSystem.java

License:BSD License

@Override
public RemoteIterator<LocatedFileStatus> listFiles(Path f, boolean recursive)
        throws FileNotFoundException, IOException {
    final UnwrappedPath unwrappedPath = unwrapPath(f);
    final RemoteIterator<LocatedFileStatus> it = this.wrappedFS.listFiles(unwrappedPath, recursive);
    return new RemoteIterator<LocatedFileStatus>() {
        @Override/*from  ww  w  .j av a2  s. c o m*/
        public boolean hasNext() throws IOException {
            return it.hasNext();
        }

        @Override
        public LocatedFileStatus next() throws IOException {
            LocatedFileStatus fileStatus = it.next();
            if (unwrappedPath.isUnwrapped()) {
                fileStatus.setPath(setAuthority(wrapPath(fileStatus.getPath()), f.toUri().getAuthority()));
            }
            return fileStatus;
        }
    };
}

From source file:de.zib.sfs.StatisticsFileSystem.java

License:BSD License

@Override
public RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f) throws FileNotFoundException, IOException {
    final UnwrappedPath unwrappedPath = unwrapPath(f);
    final RemoteIterator<LocatedFileStatus> it = this.wrappedFS.listLocatedStatus(unwrappedPath);
    return new RemoteIterator<LocatedFileStatus>() {
        @Override//from  ww  w . j  a va  2 s.  c o m
        public boolean hasNext() throws IOException {
            return it.hasNext();
        }

        @Override
        public LocatedFileStatus next() throws IOException {
            LocatedFileStatus fileStatus = it.next();
            if (unwrappedPath.isUnwrapped()) {
                fileStatus.setPath(setAuthority(wrapPath(fileStatus.getPath()), f.toUri().getAuthority()));
            }
            return fileStatus;
        }
    };
}