org.bioquery.query
Class QueryXmlConverter
java.lang.Object
|
+--org.bioquery.query.QueryXmlConverter
- public class QueryXmlConverter
- extends java.lang.Object
This class can write a Query object to XML and can read the XML
and convert it back into a Query object. This is an alternative to
standard Java serialization and a convienient way to save Querys
and transmit them across networks. The custom XML attributes and parameters for
for saving Query state is hard coded here and is undocumented.
However, inspection of a saved Query will reveal the fairly
straightforward coding scheme.
- Author:
- James Brundege
|
Method Summary |
static Query |
readQuery(java.lang.Object source)
This method reads an XML representation of a Query from the given
source and returns a new Query object. |
static void |
writeQuery(Query theQuery,
java.lang.Object destination)
This method writes the given Query to the destination as
textual XML. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
QueryXmlConverter
public QueryXmlConverter()
writeQuery
public static void writeQuery(Query theQuery,
java.lang.Object destination)
throws java.io.IOException
This method writes the given Query to the destination as
textual XML. Valid destinations are:
- OutputStream
- Writer
- File
- String filename
The first two will send the XML to the OutputStream, while the second two will
write the XML into a file. If the filename exists it is automatically
overwritten.
To reinstantiate the Query pass the destination to the readQuery
method.
readQuery
public static Query readQuery(java.lang.Object source)
throws java.lang.Exception
This method reads an XML representation of a Query from the given
source and returns a new Query object. A valid XML source
of a Query should be obtained by passing the Query to
the writeQuery method.
Valid source objects are:
- InputStream
- Reader
- File
- String filename