本文整理了Java中org.apache.flink.util.FileUtils.deleteDirectoryQuietly()
方法的一些代码示例,展示了FileUtils.deleteDirectoryQuietly()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.deleteDirectoryQuietly()
方法的具体详情如下:
包路径:org.apache.flink.util.FileUtils
类名称:FileUtils
方法名:deleteDirectoryQuietly
[英]Deletes the given directory recursively, not reporting any I/O exceptions that occur.
This method is identical to FileUtils#deleteDirectory(File), except that it swallows all exceptions and may leave the job quietly incomplete.
[中]递归删除给定目录,不报告发生的任何I/O异常。
此方法与FileUtils#deleteDirectory(文件)相同,只是它会吞并所有异常,并可能使作业不完整。
代码示例来源:origin: apache/flink
@Test
public void testDeleteQuietly() throws Exception {
// should ignore the call
FileUtils.deleteDirectoryQuietly(null);
File doesNotExist = new File(tmp.getRoot(), "abc");
FileUtils.deleteDirectoryQuietly(doesNotExist);
File cannotDeleteParent = tmp.newFolder();
File cannotDeleteChild = new File(cannotDeleteParent, "child");
try {
assumeTrue(cannotDeleteChild.createNewFile());
assumeTrue(cannotDeleteParent.setWritable(false));
assumeTrue(cannotDeleteChild.setWritable(false));
FileUtils.deleteDirectoryQuietly(cannotDeleteParent);
}
finally {
//noinspection ResultOfMethodCallIgnored
cannotDeleteParent.setWritable(true);
//noinspection ResultOfMethodCallIgnored
cannotDeleteChild.setWritable(true);
}
}
代码示例来源:origin: com.alibaba.blink/flink-table
public void run() {
p.destroyForcibly();
if (pyFileDir != null) {
File pyDir = new File(pyFileDir);
FileUtils.deleteDirectoryQuietly(pyDir);
}
}
}
代码示例来源:origin: king/bravo
@Override
public void close() throws IOException {
IOUtils.closeQuietly(cancelStreamRegistry);
IOUtils.closeAllQuietly(stateColumnFamilyHandles);
IOUtils.closeQuietly(db);
IOUtils.closeQuietly(dbOptions);
IOUtils.closeQuietly(colOptions);
FileUtils.deleteDirectoryQuietly(new File(localPath));
}
内容来源于网络,如有侵权,请联系作者删除!