org.apache.flink.util.FileUtils.copy()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(164)

本文整理了Java中org.apache.flink.util.FileUtils.copy()方法的一些代码示例,展示了FileUtils.copy()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.copy()方法的具体详情如下:
包路径:org.apache.flink.util.FileUtils
类名称:FileUtils
方法名:copy

FileUtils.copy介绍

[英]Copies all files from source to target and sets executable flag. Paths might be on different systems.
[中]将所有文件从源复制到目标,并设置可执行标志。路径可能位于不同的系统上。

代码示例

代码示例来源:origin: apache/flink

private static void copyFile(Path source, Path targetDirectory, String name) throws IOException {
  Path targetFilePath = new Path(targetDirectory, name);
  deleteIfExists(targetFilePath);
  FileUtils.copy(source, targetFilePath, true);
}

代码示例来源:origin: apache/flink

private static void copyFile(Path source, Path targetDirectory, String name) throws IOException {
  Path targetFilePath = new Path(targetDirectory, name);
  deleteIfExists(targetFilePath);
  FileUtils.copy(source, targetFilePath, true);
}

代码示例来源:origin: apache/flink

private static void internalCopyDirectory(Path sourcePath, Path targetPath, boolean executable, FileSystem sFS, FileSystem tFS) throws IOException {
  tFS.mkdirs(targetPath);
  FileStatus[] contents = sFS.listStatus(sourcePath);
  for (FileStatus content : contents) {
    String distPath = content.getPath().toString();
    if (content.isDir()) {
      if (distPath.endsWith("/")) {
        distPath = distPath.substring(0, distPath.length() - 1);
      }
    }
    String localPath = targetPath + distPath.substring(distPath.lastIndexOf("/"));
    copy(content.getPath(), new Path(localPath), executable);
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

@Override
  public Path call() throws IOException {
    // let exceptions propagate. we can retrieve them later from
    // the future and report them upon access to the result
    FileUtils.copy(filePath, cachedPath, this.executable);
    return cachedPath;
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime

@Override
  public Path call() throws IOException {
    // let exceptions propagate. we can retrieve them later from
    // the future and report them upon access to the result
    FileUtils.copy(filePath, cachedPath, this.executable);
    return cachedPath;
  }
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

@Override
  public Path call() throws IOException {
    // let exceptions propagate. we can retrieve them later from
    // the future and report them upon access to the result
    FileUtils.copy(filePath, cachedPath, this.executable);
    return cachedPath;
  }
}

代码示例来源:origin: org.apache.flink/flink-core

private static void internalCopyDirectory(Path sourcePath, Path targetPath, boolean executable, FileSystem sFS, FileSystem tFS) throws IOException {
  tFS.mkdirs(targetPath);
  FileStatus[] contents = sFS.listStatus(sourcePath);
  for (FileStatus content : contents) {
    String distPath = content.getPath().toString();
    if (content.isDir()) {
      if (distPath.endsWith("/")) {
        distPath = distPath.substring(0, distPath.length() - 1);
      }
    }
    String localPath = targetPath + distPath.substring(distPath.lastIndexOf("/"));
    copy(content.getPath(), new Path(localPath), executable);
  }
}

代码示例来源:origin: com.alibaba.blink/flink-core

copy(content.getPath(), new Path(localPath), executable);

相关文章