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


Java FileUtils.deleteQuietly方法代码示例

本文整理汇总了Java中org.apache.commons.io.FileUtils.deleteQuietly方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtils.deleteQuietly方法的具体用法?Java FileUtils.deleteQuietly怎么用?Java FileUtils.deleteQuietly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.io.FileUtils的用法示例。


在下文中一共展示了FileUtils.deleteQuietly方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@Test
public void test() throws URISyntaxException {
    //Given
    Path file = Paths.get(SwaggerToAsciiDocMarkdownConfluence.class.getResource(resource).toURI());
    Path outputDirectory = Paths.get(BUILD_SWAGGER_2_MARKUP_PATH + outputPath);
    FileUtils.deleteQuietly(outputDirectory.toFile());

    //When
    Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
            .withPathsGroupedBy(GroupBy.TAGS)
            .withOutputLanguage(Language.EN)
            .withMarkupLanguage(markupLanguage)
            .build();

    Swagger2MarkupConverter.from(file)
            .withConfig(config)
            .build()
            .toFolder(outputDirectory);
}
 
开发者ID:tsypuk,项目名称:springrestdoc,代码行数:20,代码来源:SwaggerToAsciiDocMarkdownConfluence.java

示例2: generateBundleListCfg

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
private void generateBundleListCfg(AppVariantContext appVariantContext) throws IOException {
    List<String> bundleLists = AtlasBuildContext.awbBundleMap.keySet().stream().map(key -> {
        return "lib/armeabi/" + key;
    }).sorted().collect(Collectors.toList());
    File outputFile = new File(appVariantContext.getScope().getGlobalScope().getOutputsDir(), "bundleList.cfg");
    FileUtils.deleteQuietly(outputFile);
    outputFile.getParentFile().mkdirs();
    FileUtils.writeLines(outputFile, bundleLists);

    appVariantContext.bundleListCfg = outputFile;
    //Set the bundle dependencies

    List<BundleInfo> bundleInfos = new ArrayList<>();
    AtlasBuildContext.awbBundleMap.values().stream().forEach(new Consumer<AwbBundle>() {
        @Override
        public void accept(AwbBundle awbBundle) {
            bundleInfos.add(awbBundle.bundleInfo);
        }
    });

}
 
开发者ID:alibaba,项目名称:atlas,代码行数:22,代码来源:PrepareBundleInfoTask.java

示例3: replaceInternalCertificate

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@Override
public void replaceInternalCertificate(File zipFile, boolean doReboot) throws Exception {
    // Disabling reboot for testing.

    if (zipFile == null) {
        throw new Exception(getString(EXCEPTION_KEYPAIR_ZIP_MALFORMED));
    }

    Map<String, File> files = unzipFilePair(zipFile);
    File pKeyFile = files.get(KEY);
    File chainFile = files.get(CERT_CHAIN);
    // File not needed any more.
    FileUtils.deleteQuietly(zipFile);

    replaceInternalCertificate(pKeyFile, chainFile, doReboot);
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:17,代码来源:X509TrustManagerFactory.java

示例4: main

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
	System.out.println(System.getProperty("hadoop.home.dir"));
	String inputPath = args[0];
	String outputPath = args[1];
	FileUtils.deleteQuietly(new File(outputPath));

	JavaSparkContext sc = new JavaSparkContext("local", "sparkwordcount");

	JavaRDD<String> rdd = sc.textFile(inputPath);

	JavaPairRDD<String, Integer> counts = rdd
			.flatMap(x -> Arrays.asList(x.split(" ")).iterator())
			.mapToPair(x -> new Tuple2<String, Integer>((String) x, 1))
			.reduceByKey((x, y) -> x + y);

	counts.saveAsTextFile(outputPath);
	sc.close();
}
 
开发者ID:PacktPublishing,项目名称:Apache-Spark-2x-for-Java-Developers,代码行数:19,代码来源:SparkWordCount.java

示例5: setUp

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@Before
public void setUp ()
		throws Exception {

	logger.info( Boot_Container_Test.TC_HEAD + "Deleting: "
			+ csapApp.getHttpdIntegration().getHttpdWorkersFile().getParentFile().getAbsolutePath() );

	Application.setJvmInManagerMode( false );
	csapApp.setAutoReload( false );

	FileUtils.deleteQuietly( csapApp.getHttpdIntegration().getHttpdWorkersFile().getParentFile() );

	// String path =
	// Bootstrap.getThreadContextLoader().getResource("clusterConfig.js").getPath();
	// logger.info(GlobalContextTest.TC_HEAD +
	// "Loading test configuration: \n" + path);
	// File testConfig = new File(path);
	// csapApp.parseConfig(false, testConfig);
}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:20,代码来源:Metrics_Publish_Test.java

示例6: deleteOldServerResourcesPacks

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
/**
 * Keep only the 10 most recent resources packs, delete the others
 */
private void deleteOldServerResourcesPacks()
{
    try
    {
        List<File> list = Lists.newArrayList(FileUtils.listFiles(this.dirServerResourcepacks, TrueFileFilter.TRUE, (IOFileFilter)null));
        Collections.sort(list, LastModifiedFileComparator.LASTMODIFIED_REVERSE);
        int i = 0;

        for (File file1 : list)
        {
            if (i++ >= 10)
            {
                LOGGER.info("Deleting old server resource pack {}", new Object[] {file1.getName()});
                FileUtils.deleteQuietly(file1);
            }
        }
    }
    catch (IllegalArgumentException illegalargumentexception)
    {
        LOGGER.error("Error while deleting old server resource pack : {}", new Object[] {illegalargumentexception.getMessage()});
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:ResourcePackRepository.java

示例7: testcheckAndDeleteCgroup

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@Test
public void testcheckAndDeleteCgroup() throws Exception {
  CgroupsLCEResourcesHandler handler = new CgroupsLCEResourcesHandler();
  handler.setConf(new YarnConfiguration());
  handler.initConfig();

  FileUtils.deleteQuietly(cgroupDir);
  // Test 0
  // tasks file not present, should return false
  Assert.assertFalse(handler.checkAndDeleteCgroup(cgroupDir));

  File tfile = new File(cgroupDir.getAbsolutePath(), "tasks");
  FileOutputStream fos = FileUtils.openOutputStream(tfile);
  File fspy = Mockito.spy(cgroupDir);

  // Test 1, tasks file is empty
  // tasks file has no data, should return true
  Mockito.stub(fspy.delete()).toReturn(true);
  Assert.assertTrue(handler.checkAndDeleteCgroup(fspy));

  // Test 2, tasks file has data
  fos.write("1234".getBytes());
  fos.close();
  // tasks has data, would not be able to delete, should return false
  Assert.assertFalse(handler.checkAndDeleteCgroup(fspy));
  FileUtils.deleteQuietly(cgroupDir);

}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:TestCgroupsLCEResourcesHandler.java

示例8: setupRecoveryTestConf

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
/**
 * Create a test configuration that will exercise the initializeGenericKeys
 * code path.  This is a regression test for HDFS-4279.
 */
static void setupRecoveryTestConf(Configuration conf) throws IOException {
  conf.set(DFSConfigKeys.DFS_NAMESERVICES, "ns1");
  conf.set(DFSConfigKeys.DFS_HA_NAMENODE_ID_KEY, "nn1");
  conf.set(DFSUtil.addKeySuffixes(DFSConfigKeys.DFS_HA_NAMENODES_KEY_PREFIX,
    "ns1"), "nn1,nn2");
  String baseDir = System.getProperty(
      MiniDFSCluster.PROP_TEST_BUILD_DATA, "build/test/data") + "/dfs/";
  File nameDir = new File(baseDir, "nameR");
  File secondaryDir = new File(baseDir, "namesecondaryR");
  conf.set(DFSUtil.addKeySuffixes(DFSConfigKeys.
      DFS_NAMENODE_NAME_DIR_KEY, "ns1", "nn1"),
      nameDir.getCanonicalPath());
  conf.set(DFSUtil.addKeySuffixes(DFSConfigKeys.
      DFS_NAMENODE_CHECKPOINT_DIR_KEY, "ns1", "nn1"),
      secondaryDir.getCanonicalPath());
  conf.unset(DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY);
  conf.unset(DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_DIR_KEY);
  FileUtils.deleteQuietly(nameDir);
  if (!nameDir.mkdirs()) {
    throw new RuntimeException("failed to make directory " +
      nameDir.getAbsolutePath());
  }
  FileUtils.deleteQuietly(secondaryDir);
  if (!secondaryDir.mkdirs()) {
    throw new RuntimeException("failed to make directory " +
      secondaryDir.getAbsolutePath());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:33,代码来源:TestNameNodeRecovery.java

示例9: cleanup

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@After
public void cleanup() throws Exception {
  if (log != null) {
    log.close();
  }
  FileUtils.deleteQuietly(checkpointDir);
  for (int i = 0; i < dataDirs.length; i++) {
    FileUtils.deleteQuietly(dataDirs[i]);
  }
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:11,代码来源:TestLog.java

示例10: testBinWinUtilsFound

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@Test
public void testBinWinUtilsFound() throws Throwable {
  try {
    File bin = new File(methodDir, "bin");
    File winutils = new File(bin, WINUTILS_EXE);
    touch(winutils);
    assertEquals(winutils.getCanonicalPath(),
        getQualifiedBinInner(methodDir, WINUTILS_EXE).getCanonicalPath());
  } finally {
    FileUtils.deleteQuietly(methodDir);
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:13,代码来源:TestShell.java

示例11: func_183028_i

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
private void func_183028_i()
{
    List<File> list = Lists.newArrayList(FileUtils.listFiles(this.dirServerResourcepacks, TrueFileFilter.TRUE, (IOFileFilter)null));
    Collections.sort(list, LastModifiedFileComparator.LASTMODIFIED_REVERSE);
    int i = 0;

    for (File file1 : list)
    {
        if (i++ >= 10)
        {
            logger.info("Deleting old server resource pack " + file1.getName());
            FileUtils.deleteQuietly(file1);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:ResourcePackRepository.java

示例12: setUp

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
	logger.info("Deleting: {}",
			csapApp.getHttpdIntegration().getHttpdWorkersFile().getParentFile().getAbsolutePath() );

	Application.setJvmInManagerMode( false );
	csapApp.setAutoReload( false );

	FileUtils.deleteQuietly( csapApp.getHttpdIntegration().getHttpdWorkersFile().getParentFile() );

	File csapApplicationDefinition = new File(
			getClass().getResource( "/org/csap/test/data/test_application_model.json" ).getPath() );

	logger.info("Loading application: {}" + csapApplicationDefinition );


	assertThat( csapApp.loadDefinitionForJunits( false, csapApplicationDefinition ) ).as( "No Errors or warnings" ).isTrue();
	StringBuffer parsingResults = csapApp.getLastTestParseResults() ;

	this.mockMvc = MockMvcBuilders.webAppContextSetup( this.wac ).build();
	csapApp.setTestMode( true );
}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:23,代码来源:API_Model.java

示例13: finalize_me

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@AfterClass
public void finalize_me()
{
  FileUtils.deleteQuietly (tmp);
  FileUtils.deleteQuietly (incoming_root);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:7,代码来源:FileSystemDataStoreTest.java

示例14: finalize

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@Override
protected void finalize() throws Throwable {
    super.finalize();
    FileUtils.deleteQuietly(folder);
}
 
开发者ID:subes,项目名称:invesdwin-context-r,代码行数:6,代码来源:ModifiedTempFileService.java

示例15: finalize_me

import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@AfterClass
public void finalize_me()
{
   logger.info ("Removing tmp files.");
   FileUtils.deleteQuietly (tmp);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:7,代码来源:HierarchicalDirectoryBuilderTest.java


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