com.sun.enterprise.util.io.FileUtils.copyFile()方法的使用及代码示例

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

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

FileUtils.copyFile介绍

[英]This method is used to copy a given file to another file using the buffer sixe specified
[中]此方法用于使用指定的缓冲区将给定文件复制到另一个文件

代码示例

代码示例来源:origin: org.glassfish.main.cluster/cluster-admin

@Override
public void copyBootstrapFiles() throws IOException {
  for (String relativePathToFile : SECURE_ADMIN_FILE_REL_URIS_TO_COPY) {
    final File origin = new File(existingInstanceDirURI.resolve(relativePathToFile));
    final File dest = new File(newInstanceDirURI.resolve(relativePathToFile));
    FileUtils.copyFile(origin, dest);
  }
}

代码示例来源:origin: org.glassfish.cluster/cluster-admin

@Override
public void copyBootstrapFiles() throws IOException {
  for (String relativePathToFile : SECURE_ADMIN_FILE_REL_URIS_TO_COPY) {
    final File origin = new File(existingInstanceDirURI.resolve(relativePathToFile));
    final File dest = new File(newInstanceDirURI.resolve(relativePathToFile));
    FileUtils.copyFile(origin, dest);
  }
}

代码示例来源:origin: org.glassfish.common/common-util

/**
 * Copies a file.
 *
 * @param fin  File to copy
 * @param fout New file
 * @throws IOException if an error while copying the content
 */
public static void copy(File fin, File fout) throws IOException {
  if (safeIsDirectory(fin)) {
    copyTree(fin, fout);
    return;
  }
  if (!fin.exists())
    throw new IllegalArgumentException("File source doesn't exist");
  if (!safeIsDirectory(fout.getParentFile()))
    fout.getParentFile().mkdirs();
  copyFile(fin, fout);
}

代码示例来源:origin: org.glassfish.main.common/common-util

/**
 * Copies a file.
 *
 * @param fin  File to copy
 * @param fout New file
 * @throws IOException if an error while copying the content
 */
public static void copy(File fin, File fout) throws IOException {
  if (safeIsDirectory(fin)) {
    copyTree(fin, fout);
    return;
  }
  if (!fin.exists())
    throw new IllegalArgumentException("File source doesn't exist");
    if(!mkdirsMaybe(fout.getParentFile()))
      throw new RuntimeException("Can't create parent dir of output file: " + fout);
  copyFile(fin, fout);
}

代码示例来源:origin: eclipse-ee4j/glassfish

/**
 * Copies a file.
 *
 * @param fin  File to copy
 * @param fout New file
 * @throws IOException if an error while copying the content
 */
public static void copy(File fin, File fout) throws IOException {
  if (safeIsDirectory(fin)) {
    copyTree(fin, fout);
    return;
  }
  if (!fin.exists())
    throw new IllegalArgumentException("File source doesn't exist");
    if(!mkdirsMaybe(fout.getParentFile()))
      throw new RuntimeException("Can't create parent dir of output file: " + fout);
  copyFile(fin, fout);
}

代码示例来源:origin: org.glassfish.main.admin/launcher

private void setupUpgradeSecurity() throws GFLauncherException {
  // If this is an upgrade and the security manager is on,
  // copy the current server.policy file to the domain
  // before the upgrade.
  if (info.isUpgrade()
      && jvmOptions.sysProps.containsKey("java.security.manager")) {
    GFLauncherLogger.info(GFLauncherLogger.copy_server_policy);
    File source = new File(new File(new File(info.installDir, "lib"),
        "templates"), "server.policy");
    File target = new File(info.getConfigDir(), "server.policy");
    try {
      FileUtils.copyFile(source, target);
    }
    catch (IOException ioe) {
      // the actual error is wrapped differently depending on
      // whether the problem was with the source or target
      Throwable cause = ioe.getCause() == null ? ioe : ioe.getCause();
      throw new GFLauncherException(strings.get(
          "copy_server_policy_error", cause.getMessage()));
    }
  }
}

代码示例来源:origin: org.glassfish.main.security/security

FileUtils.copyFile(new File(fileName), new File(toConfigDir, parseFileName(fileName)));

代码示例来源:origin: org.glassfish.security/security

FileUtils.copyFile(new File(fileName), new File(toConfigDir, parseFileName(fileName)));

相关文章