當前位置: 首頁>>代碼示例>>Java>>正文


Java FileUtils.forceDelete方法代碼示例

本文整理匯總了Java中org.codehaus.plexus.util.FileUtils.forceDelete方法的典型用法代碼示例。如果您正苦於以下問題:Java FileUtils.forceDelete方法的具體用法?Java FileUtils.forceDelete怎麽用?Java FileUtils.forceDelete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.codehaus.plexus.util.FileUtils的用法示例。


在下文中一共展示了FileUtils.forceDelete方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: storeThemeProperties

import org.codehaus.plexus.util.FileUtils; //導入方法依賴的package包/類
/**
 * Stores the given properties object in a file named <code>theme-derived.properties</code> within the
 * given theme directory
 *
 * @param themeDirectory directory the properties file should be created in
 * @param themeProperties properties that should be written to the properties file
 * @throws IOException
 */
public static void storeThemeProperties(String themeDirectory, Properties themeProperties) throws IOException {
    File propertiesFile = new File(themeDirectory, ThemeBuilderConstants.THEME_DERIVED_PROPERTIES_FILE);

    // need to remove file if already exists so the new properties will be written
    if (propertiesFile.exists()) {
        FileUtils.forceDelete(propertiesFile);
    }

    FileWriter fileWriter = null;

    try {
        fileWriter = new FileWriter(propertiesFile);

        themeProperties.store(fileWriter, null);
    } finally {
        if (fileWriter != null) {
            fileWriter.close();
        }
    }
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:29,代碼來源:ThemeBuilderUtils.java

示例2: reset

import org.codehaus.plexus.util.FileUtils; //導入方法依賴的package包/類
@Override
public void reset() throws Exception {
  logInfo("Starting RESET " + getName());
  // cleanup
  dir = new File(config.getProperty("source.data.dir") + "/"
      + getProcess().getInputPath() + "/" + getProcess().getVersion() + "/"
      + "META");
  final File changeDir = new File(dir, "CHANGE");
  FileUtils.deleteDirectory(changeDir);

  FileUtils.forceDelete(new File(dir, "MRCUI.RRF"));
  FileUtils.forceDelete(new File(dir, "MRAUI.RRF"));

  final String ncifile =
      "nci_code_cui_map_" + getProcess().getVersion() + ".dat";
  FileUtils.forceDelete(new File(dir, ncifile));
  final String ncimemefile =
      "NCIMEME_" + getProcess().getVersion() + "_history.txt";
  FileUtils.forceDelete(new File(dir, ncimemefile));

  logInfo("Finished RESET " + getName());
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:23,代碼來源:WriteRrfHistoryFilesAlgorithm.java

示例3: execute

import org.codehaus.plexus.util.FileUtils; //導入方法依賴的package包/類
public void execute()
    throws MojoExecutionException, MojoFailureException
{
    File outFile = project.getFile();
    File backupFile = new File( outFile.getParentFile(), outFile.getName() + ".versionsBackup" );

    if ( backupFile.exists() )
    {
        getLog().info( "Restoring " + outFile + " from " + backupFile );
        try
        {
            FileUtils.copyFile( backupFile, outFile );
            FileUtils.forceDelete( backupFile );
        }
        catch ( IOException e )
        {
            throw new MojoExecutionException( e.getMessage(), e );
        }
    }
}
 
開發者ID:mojohaus,項目名稱:versions-maven-plugin,代碼行數:21,代碼來源:RevertMojo.java

示例4: execute

import org.codehaus.plexus.util.FileUtils; //導入方法依賴的package包/類
public void execute()
    throws MojoExecutionException, MojoFailureException
{
    File outFile = project.getFile();
    File backupFile = new File( outFile.getParentFile(), outFile.getName() + ".versionsBackup" );

    if ( backupFile.exists() )
    {
        getLog().info( "Accepting all changes to " + outFile );
        try
        {
            FileUtils.forceDelete( backupFile );
        }
        catch ( IOException e )
        {
            throw new MojoExecutionException( e.getMessage(), e );
        }
    }
}
 
開發者ID:mojohaus,項目名稱:versions-maven-plugin,代碼行數:20,代碼來源:CommitMojo.java

示例5: teardown

import org.codehaus.plexus.util.FileUtils; //導入方法依賴的package包/類
/**
 * Teardown.
 *
 * @throws Exception the exception
 */
@After
public void teardown() throws Exception {
  FileUtils.forceDelete(outputFile);

  File testDirectory = new File(
      ConfigUtility.getConfigProperties().getProperty("source.data.dir") + "/"
          + processExecution.getInputPath());

  FileUtils.deleteDirectory(testDirectory);

  processService.close();
  contentService.close();
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:19,代碼來源:AtomLoaderAlgorithmTest.java

示例6: teardown

import org.codehaus.plexus.util.FileUtils; //導入方法依賴的package包/類
/**
 * Teardown.
 *
 * @throws Exception the exception
 */
@After
public void teardown() throws Exception {
  FileUtils.forceDelete(outputFile);

  FileUtils.deleteDirectory(new File(
      ConfigUtility.getConfigProperties().getProperty("source.data.dir")
          + "/"  + processExecution.getInputPath()));

  processService.close();
  contentService.close();
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:17,代碼來源:PrecomputedMergeAlgorithmTest.java

示例7: teardown

import org.codehaus.plexus.util.FileUtils; //導入方法依賴的package包/類
/**
 * Teardown.
 *
 * @throws Exception the exception
 */
@After
public void teardown() throws Exception {
  FileUtils.forceDelete(outputFile);

  File testDirectory = new File(
      ConfigUtility.getConfigProperties().getProperty("source.data.dir") + "/"
          + processExecution.getInputPath());

  FileUtils.deleteDirectory(testDirectory);

  // Return the concept's component history to pre-algo-run state.
  service = new ProcessServiceJpa();
  service.setLastModifiedBy("admin");
  service.setMolecularActionFlag(false);

  if (service.getComponentHistory(preAlgoComponentHistory.getId()) == null) {
    preAlgoComponentHistory.setId(null);
    preAlgoComponentHistory =
        service.addComponentHistory(preAlgoComponentHistory);
  }

  concept.setComponentHistory(
      new ArrayList<>(Arrays.asList(preAlgoComponentHistory)));
  service.updateConcept(concept);

  service.close();
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:33,代碼來源:ReloadComponentHistoryAlgorithmTest.java

示例8: teardown

import org.codehaus.plexus.util.FileUtils; //導入方法依賴的package包/類
/**
 * Teardown.
 *
 * @throws Exception the exception
 */
@After
public void teardown() throws Exception {
  FileUtils.forceDelete(outputFile);

  FileUtils.deleteDirectory(new File(
      ConfigUtility.getConfigProperties().getProperty("source.data.dir")
          + File.separator + processExecution.getInputPath()));

  processService.close();
  contentService.close();
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:17,代碼來源:SemanticTypeLoaderAlgorithmTest.java

示例9: teardown

import org.codehaus.plexus.util.FileUtils; //導入方法依賴的package包/類
/**
 * Teardown.
 *
 * @throws Exception the exception
 */
@After
public void teardown() throws Exception {

  contentService = new ContentServiceJpa();
  contentService.setMolecularActionFlag(false);
  contentService.setLastModifiedBy("admin");

  if (addedMapSet != null) {
    List<Mapping> mappings = addedMapSet.getMappings();
    for (Mapping mapping : mappings) {
      contentService.removeMapping(mapping.getId());
    }
    addedMapSet.clearMappings();
    contentService.updateMapSet(addedMapSet);
    contentService.removeMapSet(addedMapSet.getId());
  }

  FileUtils.forceDelete(attributesOutputFile);

  File testDirectory = new File(
      ConfigUtility.getConfigProperties().getProperty("source.data.dir")
          + "/"  + processExecution.getInputPath());

  FileUtils.deleteDirectory(testDirectory);

  processService.close();
  contentService.close();
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:34,代碼來源:MapSetLoaderAlgorithmTest.java

示例10: copyDirectory

import org.codehaus.plexus.util.FileUtils; //導入方法依賴的package包/類
/**
 * Copies all the contents from the directory given by the source path to the directory given by the
 * target path
 *
 * <p>
 * If source directory does not exist nothing is performed. The target directory will be created if it
 * does not exist. Any hidden directories (directory names that start with ".") will be deleted from the
 * target directory
 * </p>
 *
 * @param sourceDirectoryPath absolute path to the source directory
 * @param targetDirectoryPath absolute path to the target directory
 * @throws IOException
 */
public static void copyDirectory(String sourceDirectoryPath, String targetDirectoryPath)
        throws IOException {
    File sourceDir = new File(sourceDirectoryPath);

    if (!sourceDir.exists()) {
        return;
    }

    File targetDir = new File(targetDirectoryPath);
    if (targetDir.exists()) {
        // force removal so the copy starts clean
        FileUtils.forceDelete(targetDir);
    }

    targetDir.mkdir();

    FileUtils.copyDirectoryStructure(sourceDir, targetDir);

    // remove hidden directories from the target
    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setBasedir(targetDir);

    scanner.scan();

    for (String includedDirectory : scanner.getIncludedDirectories()) {
        File subdirectory = new File(targetDir, includedDirectory);

        if (subdirectory.exists() && subdirectory.isDirectory()) {
            if (subdirectory.getName().startsWith(".")) {
                FileUtils.forceDelete(subdirectory);
            }
        }
    }
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:49,代碼來源:ThemeBuilderUtils.java

示例11: cleanupTemporaryDirectory

import org.codehaus.plexus.util.FileUtils; //導入方法依賴的package包/類
private void cleanupTemporaryDirectory( File temporaryDirectory )
    throws MojoExecutionException
{
    try
    {
        FileUtils.forceDelete( temporaryDirectory );
    }
    catch ( IOException ex )
    {
        throw new MojoExecutionException( ex.getMessage(), ex );
    }
}
 
開發者ID:mojohaus,項目名稱:templating-maven-plugin,代碼行數:13,代碼來源:AbstractFilterSourcesMojo.java

示例12: copyTestFile

import org.codehaus.plexus.util.FileUtils; //導入方法依賴的package包/類
protected void copyTestFile( File file, File target )
    throws IOException
{
    if ( target.exists() )
    {
        FileUtils.forceDelete( target );
    }

    FileUtils.copyFile( file, target );

}
 
開發者ID:mojohaus,項目名稱:webstart,代碼行數:12,代碼來源:SignToolTest.java


注:本文中的org.codehaus.plexus.util.FileUtils.forceDelete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。