mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-09-02 16:21:03 +00:00
feat[lpmap]: 增加FileChannelHeapMap
This commit is contained in:
@@ -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