当前位置: 首页>>代码示例>>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;未经允许,请勿转载。