本文整理匯總了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");
}
示例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);
}
}
示例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);
}