Package org.syncany.database.dao
Class DatabaseXmlSerializer
- java.lang.Object
-
- org.syncany.database.dao.DatabaseXmlSerializer
-
public class DatabaseXmlSerializer extends java.lang.Object
Serializes aMemoryDatabase
or a list ofDatabaseVersion
s to an XML-based file format, using aTransformer
to compress/encrypt the file before writing, and to decompress/decrypt it before reading.The class offers a variety of
save()
to serialize and store a memory database to a file, and severalload()
methods to load them from disk.It uses a
DatabaseXmlWriter
to write XML files to disk andDatabaseXmlParseHandler
to parse them while reading.- See Also:
DatabaseXmlParseHandler
,DatabaseXmlWriter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DatabaseXmlSerializer.DatabaseReadType
-
Constructor Summary
Constructors Constructor Description DatabaseXmlSerializer()
DatabaseXmlSerializer(Transformer transformer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
load(MemoryDatabase db, java.io.File databaseFile, VectorClock fromVersion, VectorClock toVersion, DatabaseXmlSerializer.DatabaseReadType readType)
void
save(java.util.Iterator<DatabaseVersion> databaseVersions, java.io.File destinationFile)
void
save(java.util.List<DatabaseVersion> databaseVersions, java.io.File destinationFile)
-
-
-
Constructor Detail
-
DatabaseXmlSerializer
public DatabaseXmlSerializer()
-
DatabaseXmlSerializer
public DatabaseXmlSerializer(Transformer transformer)
-
-
Method Detail
-
save
public void save(java.util.List<DatabaseVersion> databaseVersions, java.io.File destinationFile) throws java.io.IOException
- Throws:
java.io.IOException
-
save
public void save(java.util.Iterator<DatabaseVersion> databaseVersions, java.io.File destinationFile) throws java.io.IOException
- Throws:
java.io.IOException
-
load
public void load(MemoryDatabase db, java.io.File databaseFile, VectorClock fromVersion, VectorClock toVersion, DatabaseXmlSerializer.DatabaseReadType readType) throws java.io.IOException
- Throws:
java.io.IOException
-
-