mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-14 16:18:13 +00:00
feat[lpmap]: 增加FileChannelHeapMap
This commit is contained in:
1 parent
91cfd38052
commit
bad0a3f88c
8 files changed
+415
-36
No files matched your search
@@ -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()) {
|
||||
|
||||
Reference in new issue
Block a user