當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。