org.apache.tools.ant.util.FileUtils.delete()方法的使用及代码示例

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

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

FileUtils.delete介绍

[英]Delete the file with File#delete() if the argument is not null. Do nothing on a null argument.
[中]如果参数不为null,请使用file#Delete()删除该文件。对空参数不执行任何操作。

代码示例

代码示例来源:origin: org.apache.ant/ant

private void deleteAfter(final File f, final Process p) {
    new Thread(() -> {
      try {
        p.waitFor();
      } catch (InterruptedException e) {
        // ignore
      }
      FileUtils.delete(f);
    }).start();
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * helper method to execute our command on VMS.
 * @param cmd Commandline
 * @param firstFileName int
 * @return boolean
 */
private boolean execOnVMS(Commandline cmd, int firstFileName) {
  File vmsFile = null;
  try {
    vmsFile = JavaEnvUtils.createVmsJavaOptionFile(cmd.getArguments());
    String[] commandLine = {cmd.getExecutable(),
                "-V",
                vmsFile.getPath()};
    return 0 == executeExternalCompile(commandLine,
            firstFileName,
            true);
  } catch (IOException e) {
    throw new BuildException(
      "Failed to create a temporary file for \"-V\" switch");
  } finally {
    FileUtils.delete(vmsFile);
  }
}

代码示例来源:origin: HuaweiBigData/StreamCQL

/**
 * 解压缩jar包
 *
 */
public void expand()
  throws IOException
{
  File[] fs = jarsDir.listFiles(new JarFilter());
  if (fs == null)
  {
    return; 
  }
  
  for (File f : fs)
  {
    LOG.info("start to unzip jar {}", f.getName());
    unzipJar(f.getCanonicalPath());
    FileUtils.delete(f);
  }
  LOG.info("finished to unzip jar to dir");
}

代码示例来源:origin: net.wasdev.wlp.ant/wlp-anttasks

@Override
public void execute() {
  super.initTask();
  final List<File> files = scanFileSets();
  long appStopTimeout = APP_STOP_TIMEOUT_DEFAULT;
  if (timeout != null && !timeout.equals("")) {
    appStopTimeout = Long.valueOf(timeout);
  }
  
  for (File file : files) {
    log(MessageFormat.format(messages.getString("info.undeploy"), file.getName()));
    FileUtils.delete(file);
    //check stop message code
    String stopMessage = STOP_APP_MESSAGE_CODE_REG + getFileName(file.getName());
    if (waitForStringInLog(stopMessage, appStopTimeout, getLogFile()) == null) {
      throw new BuildException(MessageFormat.format(messages.getString("error.undeploy.fail"), file.getPath()));
    }
  }
}

代码示例来源:origin: dita-ot/dita-ot

logger.error("Failed to transform document: " + e.getMessage(), e);
logger.debug("Remove " + tmp.getAbsolutePath());
FileUtils.delete(tmp);

代码示例来源:origin: dita-ot/dita-ot

} finally {
  logger.debug("Remove " + tmp.toURI());
  FileUtils.delete(tmp);

代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin

File targetServerPath = serverInfo.resolveServer(relativeTargetServerPath);
if (targetServerPath.exists()) {
  FileUtils.delete(targetServerPath);

代码示例来源:origin: lookfirst/sardine

/**
 * Process an individual file with sardine.put()
 */
private void process(File file, URL dest, boolean expectContinue) throws Exception {
  log("putting " + file + " to " + dest + " with expectContinue=" + expectContinue, Project.MSG_VERBOSE);
  if (filterSets.hasFilters() || !filterChains.isEmpty()) {
    Resource filteredResult;
    File tempFile = null;
    if (inMemoryFiltering) {
      filteredResult = new StringResource();
    } else {
      tempFile = File.createTempFile("filterResult", ".tmp");
      filteredResult = new FileResource(tempFile);
    }
    try {
      ResourceUtils.copyResource(new FileResource(file), filteredResult, filterSets, filterChains, false,
          false, false, inputEncoding, outputEncoding, getProject());
      getSardine().put(dest.toString(), filteredResult.getInputStream(), contentType, expectContinue);
    } finally {
      FileUtils.delete(tempFile);
    }
  } else {
    getSardine().put(dest.toString(), file, contentType, expectContinue);
  }
}

代码示例来源:origin: org.wso2.carbon.commons/org.wso2.carbon.identity.user.store.configuration.deployer

FileUtils.delete(file);

代码示例来源:origin: wso2/carbon-identity-framework

FileUtils.delete(file);

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.user.store.configuration.deployer

FileUtils.delete(file);

代码示例来源:origin: dita-ot/dita-ot

logger.info("All content in " + file.getAbsolutePath() + " was filtered out");
job.remove(f);
FileUtils.delete(file);

代码示例来源:origin: de.rototor.jeuclid/jeuclid-core

FileUtils.delete(outFile);

相关文章