public final class XMLSerializer extends Object
Most efficient way to serialize a subtree into an OutputStream. The encoding always is UTF-8. Note that the OutputStream internally is wrapped by a BufferedOutputStream. There is no need to buffer it again outside of this class.
Modifier and Type | Class and Description |
---|---|
static class |
XMLSerializer.XMLSerializerBuilder
XMLSerializerBuilder to setup the XMLSerializer.
|
Modifier and Type | Field and Description |
---|---|
protected long |
mNodeKey
Root node key of subtree to shredder.
|
protected ISession |
mSession
Treetank session
ISession . |
protected Stack<Long> |
mStack
Stack for reading end element.
|
protected long[] |
mVersions
Array with versions to print.
|
Modifier and Type | Method and Description |
---|---|
Void |
call()
Serialize the storage.
|
protected void |
emitEndDocument()
Emit end document.
|
protected void |
emitEndElement(INodeReadTrx paramRTX)
Emit end element.
|
protected void |
emitEndManualElement(long mVersion)
Emit an end tag, which specifies a revision.
|
protected void |
emitStartDocument()
Emit start document.
|
protected void |
emitStartElement(INodeReadTrx paramRTX)
Emit node (start element or characters).
|
protected void |
emitStartManualElement(long mVersion)
Emit a start tag, which specifies a revision.
|
static void |
main(String... args)
Main method.
|
protected void |
write(String mString)
Write characters of string.
|
protected final long[] mVersions
protected final long mNodeKey
protected void emitStartElement(INodeReadTrx paramRTX) throws TTIOException
paramRTX
- Treetank reading transaction INodeReadTrx
.TTIOException
protected void emitEndElement(INodeReadTrx paramRTX)
paramRTX
- Read Transactionprotected void emitStartDocument()
protected void emitEndDocument()
protected void emitStartManualElement(long mVersion)
mVersion
- The revision to serialize.protected void emitEndManualElement(long mVersion)
mVersion
- The revision to serialize.protected void write(String mString) throws UnsupportedEncodingException, IOException
mString
- String to writeIOException
- if can't write to stringUnsupportedEncodingException
- if unsupport encodingpublic static void main(String... args) throws Exception
args
- args[0] specifies the input-TT file/folder; args[1] specifies
the output XML file.Exception
- Any exception.public Void call() throws TTException
call
in interface Callable<Void>
TTException
- if can't call serailzerCopyright © 2013. All Rights Reserved.