本文整理了Java中org.apache.flink.util.FileUtils.cleanDirectoryInternal()
方法的一些代码示例,展示了FileUtils.cleanDirectoryInternal()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.cleanDirectoryInternal()
方法的具体详情如下:
包路径:org.apache.flink.util.FileUtils
类名称:FileUtils
方法名:cleanDirectoryInternal
暂无
代码示例来源:origin: apache/flink
private static void deleteDirectoryInternal(File directory) throws IOException {
if (directory.isDirectory()) {
// directory exists and is a directory
// empty the directory first
try {
cleanDirectoryInternal(directory);
}
catch (FileNotFoundException ignored) {
// someone concurrently deleted the directory, nothing to do for us
return;
}
// delete the directory. this fails if the directory is not empty, meaning
// if new files got concurrently created. we want to fail then.
// if someone else deleted the empty directory concurrently, we don't mind
// the result is the same for us, after all
Files.deleteIfExists(directory.toPath());
}
else if (directory.exists()) {
// exists but is file, not directory
// either an error from the caller, or concurrently a file got created
throw new IOException(directory + " is not a directory");
}
// else: does not exist, which is okay (as if deleted)
}
代码示例来源:origin: com.alibaba.blink/flink-core
private static void deleteDirectoryInternal(File directory) throws IOException {
if (directory.isDirectory()) {
// directory exists and is a directory
// empty the directory first
try {
cleanDirectoryInternal(directory);
}
catch (FileNotFoundException ignored) {
// someone concurrently deleted the directory, nothing to do for us
return;
}
// delete the directory. this fails if the directory is not empty, meaning
// if new files got concurrently created. we want to fail then.
// if someone else deleted the empty directory concurrently, we don't mind
// the result is the same for us, after all
Files.deleteIfExists(directory.toPath());
}
else if (directory.exists()) {
// exists but is file, not directory
// either an error from the caller, or concurrently a file got created
throw new IOException(directory + " is not a directory");
}
// else: does not exist, which is okay (as if deleted)
}
代码示例来源:origin: org.apache.flink/flink-core
private static void deleteDirectoryInternal(File directory) throws IOException {
if (directory.isDirectory()) {
// directory exists and is a directory
// empty the directory first
try {
cleanDirectoryInternal(directory);
}
catch (FileNotFoundException ignored) {
// someone concurrently deleted the directory, nothing to do for us
return;
}
// delete the directory. this fails if the directory is not empty, meaning
// if new files got concurrently created. we want to fail then.
// if someone else deleted the empty directory concurrently, we don't mind
// the result is the same for us, after all
Files.deleteIfExists(directory.toPath());
}
else if (directory.exists()) {
// exists but is file, not directory
// either an error from the caller, or concurrently a file got created
throw new IOException(directory + " is not a directory");
}
// else: does not exist, which is okay (as if deleted)
}
内容来源于网络,如有侵权,请联系作者删除!