code: private void copyFileToLocal(AlluxioURI srcPath, AlluxioURI dstPath)
        throws AlluxioException, IOException {
      File dstFile = new File(dstPath.getPath());
      String randomSuffix =
          String.format(".%s_copyToLocal_", RandomStringUtils.randomAlphanumeric(8));
      File outputFile;
      if (dstFile.isDirectory()) {
        outputFile = new File(PathUtils.concatPath(dstFile.getAbsolutePath(), srcPath.getName()));
      } else {
        outputFile = dstFile;
      }
      File tmpDst = new File(outputFile.getPath() + randomSuffix);
  
      try (Closer closer = Closer.create()) {
        FileInStream is = closer.register(mFileSystem.openFile(srcPath));
        FileOutputStream out = closer.register(new FileOutputStream(tmpDst));
        byte[] buf = new byte[mCopyToLocalBufferSize];
        int t = is.read(buf);
        while (t != -1) {
          out.write(buf, 0, t);
          t = is.read(buf);
        }
        if (!tmpDst.renameTo(outputFile)) {
          throw new IOException(
              "Failed to rename " + tmpDst.getPath() + " to destination " + outputFile.getPath());
        }
        System.out.println("Copied " + srcPath + " to " + "file://" + outputFile.getPath());
      } finally {
        tmpDst.delete();
      }
    }
docs: Copies a file specified by argv from the filesystem to the local filesystem. This is the
  utility function.
  
  @param srcPath The source {@link AlluxioURI} (has to be a file)
  @param dstPath The {@link AlluxioURI} of the destination in the local filesystem