comirva.audio
Interface XMLSerializable

All Known Implementing Classes:
EntityTermProfile, FluctuationPattern, FluctuationPatternCent, GaussianComponent, GaussianMixture, MandelEllis, Matrix, SingleTermList, SpectralPatternCent, TimbreDistribution

public interface XMLSerializable

XML Serialization

Description:

Allows object xml serialization. To make an object implementing this interface persistent, it is enough to simply call writeXML() with a valid XMLStreamWriter. To load an object again it suffices to create an empty object of this type and call readXML().

It is recommended to set protected access to the empty object constructor and provide a static read() method, such that one can only construct vaild objects.

Please note, that there is no mechanism to detect cycles during the serialization process. Due to the recursive design of this interface deep object structures might raise a java.lang.StackOverflowError.


Method Summary
 void readXML(XMLStreamReader parser)
          Reads the xml representation of an object form the xml input stream.
 void writeXML(XMLStreamWriter writer)
          Writes the xml representation of this object to the xml output stream.
 

Method Detail

writeXML

void writeXML(XMLStreamWriter writer)
              throws IOException,
                     XMLStreamException
Writes the xml representation of this object to the xml output stream.

There is the convention, that each call to a writeXML() method results in one xml element in the output stream.

Parameters:
writer - XMLStreamWriter the xml output stream
Throws:
IOException - raised, if there are any io troubles
XMLStreamException - raised, if there are any parsing errors

readXML

void readXML(XMLStreamReader parser)
             throws IOException,
                    XMLStreamException
Reads the xml representation of an object form the xml input stream.

There is the convention, that readXML() starts parsing by checking the start tag of this object and finishes parsing by checking the end tag. The caller has to ensure, that at method entry the current token is the start tag. After the method call it's the callers responsibility to move from the end tag to the next token.

Parameters:
parser - XMLStreamReader the xml input stream
Throws:
IOException - raised, if there are any io troubles
XMLStreamException - raised, if there are any parsing errors