mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2026-11-02 19:47:36 +00:00
ファイルにStringを保存するメソッド作成 WIP
This commit is contained in:
2 files changed
+15
-1
No files matched your search
@@ -29,6 +29,9 @@ public interface FileManager {
|
||||
String loadText(String fileName);
|
||||
String loadText(Path path);
|
||||
|
||||
void saveText(String text, String fileName);
|
||||
void saveText(String text, Path path);
|
||||
|
||||
boolean isExist(Path path);
|
||||
boolean isExist(String fileName);
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ public class FileManagerImpl implements FileManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String loadText(String fileName) {
|
||||
public String loadText(String fileName) { // TODO-rca: 統合
|
||||
try(FileInputStream fileInputStream = new FileInputStream(currentDir.resolve(fileName).toFile())) {
|
||||
byte[] bytes = new byte[fileInputStream.available()];
|
||||
fileInputStream.read(bytes); // TODO-rca: エラーハンドリング
|
||||
@@ -174,6 +174,17 @@ public class FileManagerImpl implements FileManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveText(String text, String fileName) {
|
||||
createFile(fileName);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveText(String text, Path path) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExist(Path path) {
|
||||
logger.debug("isExist", "called");
|
||||
|
||||
Reference in new issue
Block a user