From f000addbce524162d200b98f91f91132288b6f39 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 8 Jan 2024 12:20:12 +0900 Subject: [PATCH] =?UTF-8?q?Document=E3=82=AA=E3=83=96=E3=82=B8=E3=82=A7?= =?UTF-8?q?=E3=82=AF=E3=83=88=E8=AA=AD=E3=81=BF=E8=BE=BC=E3=81=BF=E3=83=A1?= =?UTF-8?q?=E3=82=BD=E3=83=83=E3=83=89=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/source/file/FileManager.java | 4 ++++ .../source/file/impl/FileManagerImpl.java | 22 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/source/src/main/java/one/nem/lacerta/source/file/FileManager.java b/source/src/main/java/one/nem/lacerta/source/file/FileManager.java index e7c04605..f5b3ae33 100644 --- a/source/src/main/java/one/nem/lacerta/source/file/FileManager.java +++ b/source/src/main/java/one/nem/lacerta/source/file/FileManager.java @@ -37,6 +37,10 @@ public interface FileManager { void saveDocument(Document document, String fileName); void saveDocument(Document document, Path path); + Document loadDocument(String fileName); + Document loadDocument(Path path); + + boolean isExist(Path path); boolean isExist(String fileName); diff --git a/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java b/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java index 12c9ebe8..f6c58aed 100644 --- a/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java +++ b/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java @@ -13,6 +13,8 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.List; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; @@ -243,6 +245,26 @@ public class FileManagerImpl implements FileManager { // 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 public boolean isExist(Path path) { logger.debug("isExist", "called");