本文整理汇总了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);
}
示例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);
}
});
}
示例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);
}
示例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();
}
示例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);
}
示例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()});
}
}
示例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);
}
示例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());
}
}
示例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]);
}
}
示例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);
}
}
示例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);
}
}
}
示例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 );
}
示例13: finalize_me
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@AfterClass
public void finalize_me()
{
FileUtils.deleteQuietly (tmp);
FileUtils.deleteQuietly (incoming_root);
}
示例14: finalize
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@Override
protected void finalize() throws Throwable {
super.finalize();
FileUtils.deleteQuietly(folder);
}
示例15: finalize_me
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@AfterClass
public void finalize_me()
{
logger.info ("Removing tmp files.");
FileUtils.deleteQuietly (tmp);
}