Class XMLSerializer
java.lang.Object
com.inductiveautomation.ignition.common.xmlserialization.serialization.XMLSerializer
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add another object to serializevoid
addRootAttribute
(String key, String value) Merges the given attribute for the root element into the existing attributes (if any).void
addSerializationDelegate
(Class clazz, SerializationDelegate<?> delegate) void
addSupertypeDelegate
(Class clazz, SerializationDelegate<?> delegate) protected Element
createTopElement
(List<Element> elements) Calls getClassNameMap().addDefaults() in a chaining invocation style.void
registerEqualityDelegate
(Class<?> clazz, EqualityDelegate<?> delegate) Deprecated.void
serialize
(SerializationWriter writer) Serializes the object graph to the given serialization writer.void
serialize
(OutputStream out) Deprecated.useserializeXML(OutputStream, String)
instead.void
serialize
(OutputStream out, String encoding) Deprecated.useserializeXML(OutputStream, String)
instead.void
Deprecated.useserializeXML(Writer, String)
instead.void
Deprecated.useserializeXML(Writer, String)
instead.byte[]
Deprecated.useserializeXMLAndGZip()
instead.byte[]
serializeAndGZip
(Object obj) Deprecated.useserializeXMLAndGZip(Object)
instead.byte[]
serializeBinary
(boolean gzip) Serialize using the binary format.void
serializeBinary
(OutputStream stream) Serializes the added object(s) to the stream, and closes the stream.byte[]
serializeBinary
(Object object, boolean gzip) Serialize the given object using binary format.Serialize to non-compressed XML using the default encoding (UTF-8)void
serializeXML
(OutputStream out, String encoding) Serialize to XML format using the specified encoding.void
serializeXML
(Writer out, String encoding) Serialize to XML format using the specified encoding.byte[]
Serializes and gzips using UTF-8 encodingbyte[]
Convenience shortcut for:static void
setCleanCopy
(Class type, Object obj)
-
Field Details
-
DEFAULT_ENCODING
-
-
Constructor Details
-
XMLSerializer
public XMLSerializer()
-
-
Method Details
-
initDefaults
Calls getClassNameMap().addDefaults() in a chaining invocation style. -
addRootAttribute
Merges the given attribute for the root element into the existing attributes (if any). These attributes can be read on the deserialization side without needing to deserialize the entire structure. -
addSerializationDelegate
-
addSupertypeDelegate
-
addObject
Add another object to serialize -
serializeAndGZip
Deprecated.useserializeXMLAndGZip(Object)
instead.- Throws:
SerializationException
-
serializeAndGZip
Deprecated.useserializeXMLAndGZip()
instead.- Throws:
SerializationException
-
serializeXMLAndGZip
Convenience shortcut for:serializer.addObject(obj); return serializer.serializeXMLAndGZip();
- Throws:
SerializationException
-
serializeXMLAndGZip
Serializes and gzips using UTF-8 encoding- Throws:
SerializationException
-
serialize
Deprecated.UseserializeXML()
instead.- Throws:
SerializationException
-
serialize
Deprecated.useserializeXML(OutputStream, String)
instead.- Throws:
SerializationException
-
serialize
Deprecated.useserializeXML(OutputStream, String)
instead.- Throws:
SerializationException
-
serialize
Deprecated.useserializeXML(Writer, String)
instead.- Throws:
SerializationException
-
serialize
Deprecated.useserializeXML(Writer, String)
instead.- Throws:
SerializationException
-
serializeXML
Serialize to non-compressed XML using the default encoding (UTF-8)- Throws:
SerializationException
-
serializeXML
Serialize to XML format using the specified encoding.- Throws:
SerializationException
-
serializeXML
Serialize to XML format using the specified encoding.- Throws:
SerializationException
-
serializeBinary
Serialize the given object using binary format. Shortcut for:serializer.addObject(object); serializer.serializeBinary(gzipFlag);
- Throws:
SerializationException
-
serializeBinary
Serialize using the binary format. Optional gzip compression.- Throws:
SerializationException
-
serializeBinary
Serializes the added object(s) to the stream, and closes the stream.- Throws:
SerializationException
-
serialize
Serializes the object graph to the given serialization writer.- Throws:
SerializationException
-
createTopElement
-
setCleanCopy
-
getClassNameMap
-
registerEqualityDelegate
-
serializeXML()
instead.