From 240c9d28e99b559ec50911283643500926e22dee Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Wed, 28 Feb 2018 17:25:25 +0100 Subject: [PATCH] Added export database in file method. --- src/fr/devinsy/sikevadb/core/XMLSikevaDB.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/fr/devinsy/sikevadb/core/XMLSikevaDB.java b/src/fr/devinsy/sikevadb/core/XMLSikevaDB.java index cf5493f..de0cdd6 100644 --- a/src/fr/devinsy/sikevadb/core/XMLSikevaDB.java +++ b/src/fr/devinsy/sikevadb/core/XMLSikevaDB.java @@ -19,6 +19,8 @@ package fr.devinsy.sikevadb.core; import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; @@ -45,6 +47,23 @@ public class XMLSikevaDB { private static final Logger logger = LoggerFactory.getLogger(XMLSikevaDB.class); + /** + * Export in XML a database in a file. + * + * @param out + * the out + * @param source + * the source + * @throws SikevaDBException + * the SikevaDB exception + * @throws FileNotFoundException + * the file not found exception + */ + public static void export(final File out, final SikevaDB source) throws SikevaDBException, FileNotFoundException + { + export(new FileOutputStream(out), source, out.getName()); + } + /** * Export. * @@ -53,7 +72,7 @@ public class XMLSikevaDB * @param source * the source * @throws SikevaDBException - * the sikeva DB exception + * the SikevaDB exception */ public static void export(final OutputStream out, final SikevaDB source) throws SikevaDBException { @@ -74,7 +93,7 @@ public class XMLSikevaDB * @param fileName * the file name * @throws SikevaDBException - * the sikeva DB exception + * the SikevaDB exception */ public static void export(final OutputStream out, final SikevaDB source, final String fileName) throws SikevaDBException { @@ -138,6 +157,8 @@ public class XMLSikevaDB */ public static void importData(final SikevaDB database, final File file) { + // TODO + // XMLReader in = null; // try { // in = new XMLZipReader(file);