mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
WIP Documentオブジェクト保存メソッド作成
This commit is contained in:
parent
6e514b216a
commit
5c0fd4fdbb
|
@ -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);
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue
Block a user