SMILA (incubation) API documentation

org.eclipse.smila.datamodel.xml
Class XmlSerializationUtils

java.lang.Object
  extended by org.eclipse.smila.datamodel.xml.XmlSerializationUtils

public final class XmlSerializationUtils
extends java.lang.Object

The Class XmlSerializationUtils.


Method Summary
static Record deserialize(byte[] byteArray)
          De-serialize a serialized record (byte[]) to a record.
static Record deserialize(org.w3c.dom.Document document)
          Deserialize a record from a Document.
static Record deserialize(java.lang.String xmlString)
          Deserialize a record from an xmlString.
static Record deserializeNoAttachments(java.io.InputStream recordInputStream)
           
static DOMRecordReader getRecordParser()
          Get the RecordParser.
static StaxRecordReader getRecordReader()
          Get the RecordReader.
static StaxRecordWriter getRecordWriter()
          Get the RecordWriter.
static javax.xml.stream.XMLInputFactory getStaxReaderFactory()
          Get the XMLInputFactory.
static javax.xml.stream.XMLOutputFactory getStaxWriterFactory()
          Get the XMLOutputFactory.
static byte[] serialize2byteArray(Record record)
          Serializes a Record into a byte[].
static java.io.ByteArrayOutputStream serialize2stream(Record record)
          Serializes a Record in UTF-8 into a ByteArrayOutputStream.
static void serialize2stream(Record record, java.io.OutputStream out)
          Serializes a Record into the given stream in UTF-8.
static java.lang.String serialize2string(Record record)
          Serializes a Record into a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

serialize2string

public static java.lang.String serialize2string(Record record)
Serializes a Record into a String. It does NOT serialize Attachment values, only their names !

Parameters:
record - the record
Returns:
the string

serialize2byteArray

public static byte[] serialize2byteArray(Record record)
Serializes a Record into a byte[]. The serialized record does contain Attachment values!

Parameters:
record - the record
Returns:
the byte[]

serialize2stream

public static java.io.ByteArrayOutputStream serialize2stream(Record record)
Serializes a Record in UTF-8 into a ByteArrayOutputStream. It does NOT serialize Attachment values, only their names !

Parameters:
record - the record
Returns:
the ByteArrayOutputStream

serialize2stream

public static void serialize2stream(Record record,
                                    java.io.OutputStream out)
Serializes a Record into the given stream in UTF-8. It does NOT serialize Attachment values, only their names !

Parameters:
record - the record
out - needs to be closed by the caller

deserialize

public static Record deserialize(byte[] byteArray)
                          throws DeserializationException
De-serialize a serialized record (byte[]) to a record. If the serialized Record contained Attachments, the deserialized record also contains these attachments as byte[].

Parameters:
byteArray - the byte array
Returns:
the record
Throws:
DeserializationException - the datamodel deserialization exception

deserializeNoAttachments

public static Record deserializeNoAttachments(java.io.InputStream recordInputStream)
                                       throws javax.xml.stream.XMLStreamException
Parameters:
recordInputStream -
Returns:
Throws:
javax.xml.stream.XMLStreamException

deserialize

public static Record deserialize(java.lang.String xmlString)
                          throws DeserializationException
Deserialize a record from an xmlString. Attachments are not supported ATM.

Parameters:
xmlString - the xml string
Returns:
the record
Throws:
DeserializationException - the datamodel deserialization exception

deserialize

public static Record deserialize(org.w3c.dom.Document document)
                          throws DeserializationException
Deserialize a record from a Document. The record does not contain attachment values, only their names.

Parameters:
document - the document
Returns:
the record
Throws:
DeserializationException - the datamodel deserialization exception

getRecordParser

public static DOMRecordReader getRecordParser()
Get the RecordParser.

Returns:
the RecordParser

getStaxWriterFactory

public static javax.xml.stream.XMLOutputFactory getStaxWriterFactory()
Get the XMLOutputFactory.

Returns:
the XMLOutputFactory

getStaxReaderFactory

public static javax.xml.stream.XMLInputFactory getStaxReaderFactory()
Get the XMLInputFactory.

Returns:
the XMLInputFactory

getRecordWriter

public static StaxRecordWriter getRecordWriter()
Get the RecordWriter.

Returns:
the RecordWriter

getRecordReader

public static StaxRecordReader getRecordReader()
Get the RecordReader.

Returns:
the RecordReader

SMILA (incubation) API documentation