Package com.tagtraum.core
Class XmlDB<T>
- java.lang.Object
-
- com.tagtraum.core.XmlDB<T>
-
- Type Parameters:
T- type of the list elements
public class XmlDB<T> extends Object
XMLDB, simple, XML file based storage facility using the standardXMLEncoder/XMLDecoderserialization mechanism.- Author:
- Hendrik Schreiber
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRegexReplacement(String regex, String replacement)FilegetFile()ObjectgetSource()Source, i.e.URLgetUrl()Iterator<T>iterator()Iterator over the XMLDB file.Collection<T>read()voidread(Collection<T> targetCollection)voidsetProgressListener(ProgressListener progressListener)voidwrite(Iterable<T> iterable, int size)voidwrite(Iterable<T> iterable, int size, int batchSize)voidwrite(Collection<T> collection)
-
-
-
Constructor Detail
-
XmlDB
public XmlDB(File file, boolean compress, Cipher cipher, Key key)
- Parameters:
file- data filecompress- compress data
-
XmlDB
public XmlDB(File file)
- Parameters:
file- data file
-
XmlDB
public XmlDB(URL url, boolean compress, Cipher cipher, Key key)
URL backed read-only XmlDB.- Parameters:
url- data urlcompress- compress data
-
XmlDB
public XmlDB(URL url)
URL backed read-only XmlDB.- Parameters:
url- data file
-
-
Method Detail
-
getFile
public File getFile()
-
getUrl
public URL getUrl()
-
getSource
public Object getSource()
Source, i.e. either File or URL.- Returns:
- file or url.
-
read
public Collection<T> read() throws IOException
- Returns:
- a parametrized collection
- Throws:
IOException
-
read
public void read(Collection<T> targetCollection) throws IOException
- Parameters:
targetCollection- collection to put the data into- Throws:
IOException
-
iterator
public Iterator<T> iterator() throws IOException
Iterator over the XMLDB file.- Throws:
IOException
-
write
public void write(Collection<T> collection) throws IOException
- Parameters:
collection- collection to write- Throws:
IOException
-
write
public void write(Iterable<T> iterable, int size) throws IOException
- Parameters:
iterable- iterablesize- size- Throws:
IOException
-
write
public void write(Iterable<T> iterable, int size, int batchSize) throws IOException
- Parameters:
iterable- iterablesize- sizebatchSize- batch size- Throws:
IOException
-
setProgressListener
public void setProgressListener(ProgressListener progressListener)
-
-