本文整理汇总了Java中org.apache.commons.io.FileUtils.cleanDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtils.cleanDirectory方法的具体用法?Java FileUtils.cleanDirectory怎么用?Java FileUtils.cleanDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.io.FileUtils
的用法示例。
在下文中一共展示了FileUtils.cleanDirectory方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shutdownAll
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
private void shutdownAll() throws IOException {
VM locatorAndMgr = getHost(0).getVM(3);
locatorAndMgr.invoke(new SerializableCallable() {
@Override
public Object call() throws Exception {
GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
ShutdownAllRequest.send(cache.getDistributedSystem().getDistributionManager(), -1);
return null;
}
});
locatorAndMgr.invoke(SharedConfigurationTestUtils.cleanupLocator);
// Clean up the directories
if (!serverNames.isEmpty()) {
for (String serverName : serverNames) {
final File serverDir = new File(serverName);
FileUtils.cleanDirectory(serverDir);
FileUtils.deleteDirectory(serverDir);
}
}
serverNames.clear();
}
示例2: cleanDirectory
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
public static void cleanDirectory(File directory) {
try {
FileUtils.cleanDirectory(directory);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例3: clone
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
/**
* Cloning the remote git repo to local directory
* @param remoteUri remote git url e.g. git://gitli.example.com/project/repo.git
* @param localDir local destination clone directory
* @throws IOException
* @throws GitAPIException
*/
public static void clone(String remoteUri, String localDir) throws IOException, GitAPIException {
//create local git directory
File localGitRepo = new File(localDir);
if (localGitRepo.exists()) {
if (localGitRepo.isDirectory()) {
// clean up directory
FileUtils.cleanDirectory(localGitRepo);
} else {
throw new IOException("File exists: " + localDir);
}
} else {
localGitRepo.mkdirs();
}
Git g = Git.cloneRepository().setURI(remoteUri).setDirectory(localGitRepo).call();
g.close();
}
示例4: clear
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@Override
public void clear() {
try {
FileUtils.cleanDirectory(NANOHTTPD_TEMP);
} catch (IOException e) {
// acceptable
}
}
示例5: wipe
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
/**
* This method wipes the root folder of a storage, basically, will remove all files and folder in it.
* Be careful with this method because in too many cases this action won't provide a rollback action.
*/
public void wipe() throws UniversalIOException {
try {
FileUtils.cleanDirectory(new File(this.settings.getRoot()));
} catch (Exception e) {
UniversalIOException error = new UniversalIOException(e.getMessage());
this.triggerOnErrorListeners(error);
throw error;
}
}
示例6: deleteWebDAV
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
/**
* Delete cell webdav data.
*/
private void deleteWebDAV() {
Path webdavRootPath = Paths.get(PersoniumUnitConfig.getBlobStoreRoot(),
targetCell.getDataBundleName(), targetCell.getId());
try {
FileUtils.cleanDirectory(webdavRootPath.toFile());
} catch (IOException e) {
throw PersoniumCoreException.Common.FILE_IO_ERROR.params("delete WebDAV files").reason(e);
}
}
示例7: setUp
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() throws IOException {
if(USER_DIR.exists()) {
FileUtils.cleanDirectory(USER_DIR);
}
USER_DIR.mkdirs();
}
示例8: cleanDownloadDirectory
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@Conditioned
@Lorsque("Je vide le repertoire des téléchargements[\\.|\\?]")
@Given("I clean download directory[\\.|\\?]")
public void cleanDownloadDirectory(List<GherkinStepCondition> conditions) throws IOException {
FileUtils.forceMkdir(new File(System.getProperty("user.dir") + File.separator + "downloadFiles"));
FileUtils.cleanDirectory(new File(System.getProperty("user.dir") + File.separator + "downloadFiles"));
}
示例9: SystemSpecificCompilerAndExecutioner
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
/**
* constructor creates an error checker that compiles the c code and passes
* it on to a system specific compiler
*/
public SystemSpecificCompilerAndExecutioner() {
// clear the folder where the files that get checked get saved to,
// because sometimes they
// persist from the last time BEAST was run
try {
FileUtils.cleanDirectory(new File(SuperFolderFinder.getSuperFolder() + pathToTempFolder));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例10: clean
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
/**
* This method cleans the context of this storage. This method doesn't remove any file from the storage.
* The method will clean the tmp folder to release disk usage.
*/
public void clean() throws UniversalIOException {
try {
FileUtils.cleanDirectory(new File(this.settings.getTmp()));
} catch (Exception e) {
UniversalIOException error = new UniversalIOException(e.getMessage());
this.triggerOnErrorListeners(error);
throw error;
}
}
示例11: cleanExistingRecords
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
public static void cleanExistingRecords() {
File mappings = new File("src/test/resources/mappings");
File bodyFiles = new File("src/test/resources/__files");
try {
FileUtils.cleanDirectory(mappings);
FileUtils.cleanDirectory(bodyFiles);
} catch (IOException ex) {
System.out.println("Exception deleting Files: " + ex);
}
}
示例12: prepTests
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@BeforeClass
public static void prepTests() throws Exception {
FileUtils.cleanDirectory(RESOURCE.getFile());
}