@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);
      }
    };
  }
@ 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 ; { 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
@param f a path
@param filter a path filter
@return an iterator that traverses statuses of the files/directories
in the given path
@throws FileNotFoundException if <code>f</code> does not exist
@throws IOException if any I/O error occurred