當前位置: 首頁>>代碼示例>>Java>>正文


Java FileUtils.delete方法代碼示例

本文整理匯總了Java中org.apache.tools.ant.util.FileUtils.delete方法的典型用法代碼示例。如果您正苦於以下問題:Java FileUtils.delete方法的具體用法?Java FileUtils.delete怎麽用?Java FileUtils.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.tools.ant.util.FileUtils的用法示例。


在下文中一共展示了FileUtils.delete方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: expand

import org.apache.tools.ant.util.FileUtils; //導入方法依賴的package包/類
/**
 * 解壓縮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");
}
 
開發者ID:HuaweiBigData,項目名稱:StreamCQL,代碼行數:23,代碼來源:JarExpander.java

示例2: execOnVMS

import org.apache.tools.ant.util.FileUtils; //導入方法依賴的package包/類
/**
 * 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);
    }
}
 
開發者ID:apache,項目名稱:ant,代碼行數:25,代碼來源:JavacExternal.java

示例3: setUpTestProject

import org.apache.tools.ant.util.FileUtils; //導入方法依賴的package包/類
/** Create a test project with git source context. */
public void setUpTestProject() throws IOException {
  Path buildFile = testProjectDir.getRoot().toPath().resolve("build.gradle");

  Path src = Files.createDirectory(testProjectDir.getRoot().toPath().resolve("src"));
  InputStream buildFileContent =
      getClass()
          .getClassLoader()
          .getResourceAsStream("projects/sourcecontext-project/build.gradle");
  Files.copy(buildFileContent, buildFile);

  Path gitContext = testProjectDir.getRoot().toPath().resolve("gitContext.zip");
  InputStream gitContextContent =
      getClass()
          .getClassLoader()
          .getResourceAsStream("projects/sourcecontext-project/gitContext.zip");
  Files.copy(gitContextContent, gitContext);

  try (ZipFile zipFile = new ZipFile(gitContext.toFile())) {
    Enumeration<? extends ZipEntry> entries = zipFile.entries();
    while (entries.hasMoreElements()) {
      ZipEntry entry = entries.nextElement();
      File entryDestination = new File(testProjectDir.getRoot(), entry.getName());
      if (entry.isDirectory()) {
        entryDestination.mkdirs();
      } else {
        entryDestination.getParentFile().mkdirs();
        InputStream in = zipFile.getInputStream(entry);
        OutputStream out = new FileOutputStream(entryDestination);
        IOUtils.copy(in, out);
        IOUtils.closeQuietly(in);
        out.close();
      }
    }
  }

  FileUtils.delete(gitContext.toFile());

  Path webInf = testProjectDir.getRoot().toPath().resolve("src/main/webapp/WEB-INF");
  Files.createDirectories(webInf);
  File appengineWebXml = Files.createFile(webInf.resolve("appengine-web.xml")).toFile();
  Files.write(appengineWebXml.toPath(), "<appengine-web-app/>".getBytes(Charsets.UTF_8));
}
 
開發者ID:GoogleCloudPlatform,項目名稱:app-gradle-plugin,代碼行數:44,代碼來源:SourceContextPluginIntegrationTest.java

示例4: replaceFile

import org.apache.tools.ant.util.FileUtils; //導入方法依賴的package包/類
private void replaceFile(File src, File dest) throws IOException {
    FileUtils.delete(dest);
    FileUtils.getFileUtils().copyFile(src, dest);
}
 
開發者ID:apache,項目名稱:ant-easyant-tasks,代碼行數:5,代碼來源:JNLPTask.java


注:本文中的org.apache.tools.ant.util.FileUtils.delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。