当前位置: 首页>>代码示例>>Java>>正文


Java FileUtils.cleanDirectory方法代码示例

本文整理汇总了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();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:24,代码来源:ClusterConfigurationServiceEndToEndDUnitTest.java

示例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);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:GFileUtils.java

示例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();
}
 
开发者ID:thomas-young-2013,项目名称:wherehowsX,代码行数:25,代码来源:GitUtil.java

示例4: clear

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@Override
public void clear() {
    try {
        FileUtils.cleanDirectory(NANOHTTPD_TEMP);
    } catch (IOException e) {
        // acceptable
    }
}
 
开发者ID:dzikoysk,项目名称:NanoMaven,代码行数:9,代码来源:NanoTempFileManager.java

示例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;
    }
}
 
开发者ID:egomezr,项目名称:universal_storage_java_fs_api,代码行数:14,代码来源:UniversalFileStorage.java

示例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);
    }
}
 
开发者ID:personium,项目名称:personium-core,代码行数:13,代码来源:SnapshotFileImportRunner.java

示例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();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:TestUnnecessaryBlockingOnHistoryFileInfo.java

示例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"));
}
 
开发者ID:NoraUi,项目名称:NoraUi,代码行数:8,代码来源:CommonSteps.java

示例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();
	}
}
 
开发者ID:Skypr,项目名称:BEAST,代码行数:16,代码来源:SystemSpecificCompilerAndExecutioner.java

示例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;
    }
}
 
开发者ID:egomezr,项目名称:universal_storage_java_fs_api,代码行数:14,代码来源:UniversalFileStorage.java

示例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);
        }
    }
 
开发者ID:Sybit-Education,项目名称:airtable.java,代码行数:13,代码来源:WireMockBaseTest.java

示例12: prepTests

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@BeforeClass
public static void prepTests() throws Exception {
    FileUtils.cleanDirectory(RESOURCE.getFile());
}
 
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:5,代码来源:JsonServiceRegistryDaoTests.java


注:本文中的org.apache.commons.io.FileUtils.cleanDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。