mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-29 19:13:16 +00:00
Documentオブジェクト読み込みメソッド作成
This commit is contained in:
parent
73fa8201d6
commit
f000addbce
|
@ -37,6 +37,10 @@ public interface FileManager {
|
||||||
void saveDocument(Document document, String fileName);
|
void saveDocument(Document document, String fileName);
|
||||||
void saveDocument(Document document, Path path);
|
void saveDocument(Document document, Path path);
|
||||||
|
|
||||||
|
Document loadDocument(String fileName);
|
||||||
|
Document loadDocument(Path path);
|
||||||
|
|
||||||
|
|
||||||
boolean isExist(Path path);
|
boolean isExist(Path path);
|
||||||
boolean isExist(String fileName);
|
boolean isExist(String fileName);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.transform.Transformer;
|
import javax.xml.transform.Transformer;
|
||||||
import javax.xml.transform.TransformerFactory;
|
import javax.xml.transform.TransformerFactory;
|
||||||
import javax.xml.transform.dom.DOMSource;
|
import javax.xml.transform.dom.DOMSource;
|
||||||
|
@ -243,6 +245,26 @@ public class FileManagerImpl implements FileManager {
|
||||||
// TODO-rca 実装する
|
// TODO-rca 実装する
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Document loadDocument(String fileName) {
|
||||||
|
try {
|
||||||
|
File file = getFile(fileName);
|
||||||
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
|
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||||
|
Document document = builder.parse(file);
|
||||||
|
return document;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Document loadDocument(Path path) {
|
||||||
|
// TODO-rca 実装する
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@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