public class PluginDocumentXmlCollection extends Object
PluginDocument that contains
a large number of sub-elements so that all the elements do not need to be in memory simultaneously.
This is used for example when serializing DefaultSequenceListDocument
and DefaultAlignmentDocument, each of which may contain millions of sequences
which would take up too much memory if all the contained sequences were simultaneously in memory in their XML form.| Modifier and Type | Class and Description |
|---|---|
static class |
PluginDocumentXmlCollection.ElementHandler |
| Constructor and Description |
|---|
PluginDocumentXmlCollection() |
| Modifier and Type | Method and Description |
|---|---|
static void |
fromXml(org.jdom.Element rootElement,
PluginDocumentXmlCollection.ElementHandler childElementHandler,
ProgressListener progressListener)
deserializes some XML elements, calling
PluginDocumentXmlCollection.ElementHandler.handleElement(org.jdom.Element)
for each child element. |
static org.jdom.Element |
toXml(org.jdom.Element rootElement,
Iterable<org.jdom.Element> childElements,
int childElementsSize,
ProgressListener progressListener,
boolean serializeToFileInsteadOfMemory)
Serializes these elements into a single parent element, potentially storing them in a file (using
PluginDocument.FILE_DATA_ATTRIBUTE_NAME) |
public static org.jdom.Element toXml(org.jdom.Element rootElement,
Iterable<org.jdom.Element> childElements,
int childElementsSize,
ProgressListener progressListener,
boolean serializeToFileInsteadOfMemory)
throws XMLSerializationException
PluginDocument.FILE_DATA_ATTRIBUTE_NAME)rootElement - the root element under which to store the child elements (or the element on which to attach the file data attribute if there are too many child elements)childElements - the child elements to serialize. These may be added directly to a parent element, so they must not already be a child element of some other element.childElementsSize - the number of elements that are in childElements.progressListener - for reporting progress and handling cancelling.serializeToFileInsteadOfMemory - true to serialized to a file instead of in memory.XMLSerializationExceptionpublic static void fromXml(org.jdom.Element rootElement,
PluginDocumentXmlCollection.ElementHandler childElementHandler,
ProgressListener progressListener)
throws XMLSerializationException
PluginDocumentXmlCollection.ElementHandler.handleElement(org.jdom.Element)
for each child element. There could potentially be a lot of child elements (more than can be held simultaneously in memory as jdom elements).rootElement - a root element returned from a previous call to toXml(org.jdom.Element, Iterable, int, jebl.util.ProgressListener, boolean)childElementHandler - a callback to pass each child element of rootElement to.progressListener - for reporting progress and handling canceling.XMLSerializationException