public static LocatedFileStatus toLocatedFileStatus(HdfsFileStatus stat, LocatedBlocks locs,
      String src) {
    if (stat == null) {
      return null;
    }
    return new LocatedFileStatus(stat.getLen(),
        stat.isDir(), stat.getReplication(),
        stat.getBlockSize(), stat.getModificationTime(),
        stat.getAccessTime(),
        stat.getPermission(), stat.getOwner(), stat.getGroup(),
        stat.getFullPath(new Path(src)), // full path
        DFSUtil.locatedBlocks2Locations(locs));
  }
public static LocatedFileStatus toLocatedFileStatus ( HdfsFileStatus stat , LocatedBlocks locs , String src ) { if ( stat == null ) { return null ; } return new LocatedFileStatus ( stat . getLen ( ) , stat . isDir ( ) , stat . getReplication ( ) , stat . getBlockSize ( ) , stat . getModificationTime ( ) , stat . getAccessTime ( ) , stat . getPermission ( ) , stat . getOwner ( ) , stat . getGroup ( ) , stat . getFullPath ( new Path ( src ) ) , DFSUtil . locatedBlocks2Locations ( locs ) ) ; }
Convert an HdfsFileStatus and its block locations to a LocatedFileStatus
@param stat an HdfsFileStatus
@param locs the file's block locations
@param src parent path in string representation
@return a FileStatus object