From f3465bcf81d99d3d7210ea4448b375f557b5081c Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 9 Jan 2024 12:42:03 +0900 Subject: [PATCH] =?UTF-8?q?loadXml,=20loadXmlInternal=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/file/impl/FileManagerImpl.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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 f3c740b6..da908b49 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 @@ -211,14 +211,27 @@ public class FileManagerImpl implements FileManager { this.saveBitmapInternal(bitmap); } + // Internal + private Document loadXmlInternal() throws IOException { + try { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + return builder.parse(Files.newInputStream(this.path.toFile().toPath())); + } catch (Exception e) { + logger.error("loadXmlInternal", e.getMessage()); + throw new IOException("Failed to load xml"); + } + } + @Override public Document loadXml(String fileName) throws IOException { - return null; + this.resolve(fileName); + return this.loadXmlInternal(); } @Override public Document loadXml() throws IOException { - return null; + return this.loadXmlInternal(); } @Override