feat[lpmap]: 增加FileChannelHeapMap

This commit is contained in:
jaysunxiao
2021-08-17 17:48:14 +08:00
parent 91cfd38052
commit bad0a3f88c
8 changed files with 415 additions and 36 deletions
@@ -169,6 +169,20 @@ public abstract class FileUtils {
return newFile;
}
public static File getOrCreateFile(String path, String fileName) throws IOException {
var file = createDirectory(path);
var newFile = new File(file.getAbsoluteFile() + File.separator + fileName);
if (newFile.exists()) {
return newFile;
}
if (!newFile.createNewFile()) {
throw new RuntimeException(StringUtils.format("创建文件[fileName:{}]失败", fileName));
}
return newFile;
}
public static File createDirectory(String path) {
var file = new File(path);
if (!file.exists()) {