WIP Documentオブジェクト保存メソッド作成

This commit is contained in:
r-ca 2024-01-08 12:16:03 +09:00
parent 6e514b216a
commit 5c0fd4fdbb
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9
2 changed files with 27 additions and 0 deletions

View File

@ -2,6 +2,8 @@ package one.nem.lacerta.source.file;
import android.graphics.Bitmap;
import org.w3c.dom.Document;
import java.io.File;
import java.nio.file.Path;
import java.util.List;
@ -32,6 +34,9 @@ public interface FileManager {
void saveText(String text, String fileName);
void saveText(String text, Path path);
void saveDocument(Document document, String fileName);
void saveDocument(Document document, Path path);
boolean isExist(Path path);
boolean isExist(String fileName);

View File

@ -2,6 +2,8 @@ package one.nem.lacerta.source.file.impl;
import android.graphics.Bitmap;
import org.w3c.dom.Document;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@ -11,6 +13,10 @@ import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import dagger.assisted.Assisted;
import dagger.assisted.AssistedInject;
import one.nem.lacerta.source.file.FileManager;
@ -217,6 +223,22 @@ public class FileManagerImpl implements FileManager {
}
}
@Override
public void saveDocument(Document document, String fileName) {
try {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(document);
File file = createFile(fileName);
}
}
@Override
public void saveDocument(Document document, Path path) {
}
@Override
public boolean isExist(Path path) {
logger.debug("isExist", "called");