public static boolean checkIsOwnerOfFileHierarchy(FileSystem fs, FileStatus fileStatus,
      String userName, boolean recurse)
      throws IOException {
    if (!fileStatus.getOwner().equals(userName)) {
      return false;
    }

    if ((!fileStatus.isDirectory()) || (!recurse)) {
      // no sub dirs to be checked
      return true;
    }
    // check all children
    FileStatus[] childStatuses = null;
    try {
      childStatuses = fs.listStatus(fileStatus.getPath());
    } catch (FileNotFoundException fe) {
      LOG.debug("Skipping child access check since the directory is already removed");
      return true;
    }
    for (FileStatus childStatus : childStatuses) {
      // check children recursively - recurse is true if we're here.
      if (!checkIsOwnerOfFileHierarchy(fs, childStatus, userName, true)) {
        return false;
      }
    }
    return true;
  }
A best effort attempt to determine if if the file is a local file
@param conf
@param fileUri
@return true if it was successfully able to determine that it is a local file
common/src/java/org/apache/hadoop/hive/common/FileUtils.java