@ Deprecated public RemoteIterator < LocatedFileStatus > listLocatedStatus ( final Path f , final PathFilter filter ) throws FileNotFoundException , IOException { return new RemoteIterator < LocatedFileStatus > ( ) { private final FileStatus [ ] stats ; private int i = 0 ; { // initializer stats = listStatus ( f , filter ) ; if ( stats == null ) { throw new FileNotFoundException ( "File " + f + " does not exist." ) ; } } @ Override public boolean hasNext ( ) { return i < stats . length ; } @ Override public LocatedFileStatus next ( ) throws IOException { if ( ! hasNext ( ) ) { throw new NoSuchElementException ( "No more entry in " + f ) ; } FileStatus result = stats [ i ++ ] ; BlockLocation [ ] locs = result . isDir ( ) ? null : getFileBlockLocations ( result , 0 , result . getLen ( ) ) ; return new LocatedFileStatus ( result , locs ) ; } } ; }
Listing a directory The returned results include its block location if it is a file The results are filtered by the given path filter