code: private Path getFinalPath(Path jobOutputDir, Path taskOutput, 
                              Path taskOutputPath) throws IOException {
      URI taskOutputUri = taskOutput.toUri();
      URI relativePath = taskOutputPath.toUri().relativize(taskOutputUri);
      if (taskOutputUri == relativePath) {
        throw new IOException("Can not get the relative path: base = " + 
            taskOutputPath + " child = " + taskOutput);
      }
      if (relativePath.getPath().length() > 0) {
        return new Path(jobOutputDir, relativePath.getPath());
      } else {
        return jobOutputDir;
      }
    }
docs: Find the final name of a given output file, given the job output directory
  and the work directory.
  @param jobOutputDir the job's output directory
  @param taskOutput the specific task output file
  @param taskOutputPath the job's work directory
  @return the final path for the specific output file
  @throws IOException