本文整理汇总了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);
}