Added export database in file method.

This commit is contained in:
Christian P. MOMON 2018-02-28 17:25:25 +01:00
parent 49d906a0b8
commit 240c9d28e9

View file

@ -19,6 +19,8 @@
package fr.devinsy.sikevadb.core; package fr.devinsy.sikevadb.core;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
@ -45,6 +47,23 @@ public class XMLSikevaDB
{ {
private static final Logger logger = LoggerFactory.getLogger(XMLSikevaDB.class); 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. * Export.
* *
@ -53,7 +72,7 @@ public class XMLSikevaDB
* @param source * @param source
* the source * the source
* @throws SikevaDBException * @throws SikevaDBException
* the sikeva DB exception * the SikevaDB exception
*/ */
public static void export(final OutputStream out, final SikevaDB source) throws SikevaDBException public static void export(final OutputStream out, final SikevaDB source) throws SikevaDBException
{ {
@ -74,7 +93,7 @@ public class XMLSikevaDB
* @param fileName * @param fileName
* the file name * the file name
* @throws SikevaDBException * @throws SikevaDBException
* the sikeva DB exception * the SikevaDB exception
*/ */
public static void export(final OutputStream out, final SikevaDB source, final String fileName) throws SikevaDBException 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) public static void importData(final SikevaDB database, final File file)
{ {
// TODO
// XMLReader in = null; // XMLReader in = null;
// try { // try {
// in = new XMLZipReader(file); // in = new XMLZipReader(file);