mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 17:53:14 +00:00
ファイルにStringを保存するメソッド作成 WIP
This commit is contained in:
parent
2ba243ea4a
commit
15d454690e
|
@ -29,6 +29,9 @@ public interface FileManager {
|
||||||
String loadText(String fileName);
|
String loadText(String fileName);
|
||||||
String loadText(Path path);
|
String loadText(Path path);
|
||||||
|
|
||||||
|
void saveText(String text, String fileName);
|
||||||
|
void saveText(String text, Path path);
|
||||||
|
|
||||||
boolean isExist(Path path);
|
boolean isExist(Path path);
|
||||||
boolean isExist(String fileName);
|
boolean isExist(String fileName);
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class FileManagerImpl implements FileManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String loadText(String fileName) {
|
public String loadText(String fileName) { // TODO-rca: 統合
|
||||||
try(FileInputStream fileInputStream = new FileInputStream(currentDir.resolve(fileName).toFile())) {
|
try(FileInputStream fileInputStream = new FileInputStream(currentDir.resolve(fileName).toFile())) {
|
||||||
byte[] bytes = new byte[fileInputStream.available()];
|
byte[] bytes = new byte[fileInputStream.available()];
|
||||||
fileInputStream.read(bytes); // TODO-rca: エラーハンドリング
|
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
|
@Override
|
||||||
public boolean isExist(Path path) {
|
public boolean isExist(Path path) {
|
||||||
logger.debug("isExist", "called");
|
logger.debug("isExist", "called");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user