Class XMLDeserializer
java.lang.Object
com.inductiveautomation.ignition.common.xmlserialization.deserialization.XMLDeserializer
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected ClassNameResolverstatic final ThreadLocal<Version>Will hold the version that the data currently being deserialized was found to be serialized in, if possible.protected Map<String,DeserializationHandler> protected LoggerEx
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddHandler(DeserializationHandler handler) deserialize(byte[] bytes) Deserialize the bytes.static Objectdeserialize(XMLDeserializer deser, byte[] data, LoggerEx log) Returns the first object found in the root object stream ofdata.static Objectdeserialize(XMLDeserializer deser, byte[] data, org.apache.log4j.Logger log) Deprecated.static Objectdeserialize(XMLDeserializer deser, byte[] data, org.slf4j.Logger log) Deprecated.Prefer the overload that accepts aLoggerExinstead.Deserialize an object graph from an input stream.deserialize(Reader streamReader) Deserialize an object graph from a reader.deserialize(String xml) Deserialize an object graph from a reader.deserializeBinary(byte[] bytes) Deserialize data from a byte[], expected to be in binary format.deserializeBinary(InputStream stream, boolean topAttributesOnly) deserializeMultiple(byte[] bytes, int count) Special version of deserialization which will deserialize multiple copies of the serialized objects.deserializeXML(Reader streamReader, boolean topAttributesOnly) Initializes default handlers in chaining invocation style.protected DeserializationHandlerlookupHandler(String name) Finds the deserialization handler registered for the given element name.readRootAttributes(byte[] bytes) Reads the top element's attributes only.Reads the top element's attributes only.readRootAttributes(Reader streamReader) readRootAttributes(String xml) transcodeToXML(InputStream binary, XMLSerializer serializer) This function will take serialized data and return it in uncompressed XML format.
- 
Field Details- 
FRAMEWORK_VERSIONWill hold the version that the data currently being deserialized was found to be serialized in, if possible. Only non-null during deserialization.
- 
instanceHandlers
- 
classNameMap
- 
log
 
- 
- 
Constructor Details- 
XMLDeserializerpublic XMLDeserializer()
- 
XMLDeserializer
 
- 
- 
Method Details- 
deserialize@Deprecated public static Object deserialize(XMLDeserializer deser, byte[] data, org.apache.log4j.Logger log) throws SerializationException Deprecated.Prefer the overload that accepts aLoggerExinstead.- Throws:
- SerializationException
 
- 
deserialize@Deprecated(since="8.1.25") public static Object deserialize(XMLDeserializer deser, byte[] data, org.slf4j.Logger log) throws SerializationException Deprecated.Prefer the overload that accepts aLoggerExinstead.- Throws:
- SerializationException
 
- 
deserializepublic static Object deserialize(XMLDeserializer deser, byte[] data, LoggerEx log) throws SerializationException Returns the first object found in the root object stream ofdata. Reports warnings tolog.- Returns:
- null if the input data is null or empty. Otherwise, the arbitrary serialized object contained in
 data.
- Throws:
- SerializationException- if the data is not valid serialized data, or contains no root objects.
 
- 
initDefaultsInitializes default handlers in chaining invocation style. Do not call unlessy you instantiated an XMLDeserializer yourself (generally not the thing to do: get one from your context)
- 
addHandler
- 
deserializeDeserialize the bytes. Automatically detects GZip compression and binary vs. XML encoding.- Returns:
- DeserializationContext that will contain the root of the serialized object graph, as well as any serialization warnings that occurred.
- Throws:
- SerializationException
 
- 
deserializeDeserialize an object graph from an input stream. Gzip compression and XML vs binary encoding are automatically detected.- Throws:
- SerializationException
 
- 
deserializeDeserialize an object graph from a reader. Encoding is assumed to be XML- Throws:
- SerializationException
 
- 
deserializeDeserialize an object graph from a reader. Encoding is assumed to be XML- Throws:
- SerializationException
 
- 
readRootAttributes- Throws:
- SerializationException
 
- 
readRootAttributes- Throws:
- SerializationException
 
- 
readRootAttributesReads the top element's attributes only. Automatically detects GZip compression and xml vs binary format- Throws:
- SerializationException
 
- 
readRootAttributesReads the top element's attributes only. Automatically detects GZip compression and xml vs binary format.- Throws:
- SerializationException
 
- 
deserializeBinaryDeserialize data from a byte[], expected to be in binary format. Detects GZip automaticaly.- Throws:
- SerializationException
 
- 
deserializeBinarypublic DeserializationContext deserializeBinary(InputStream stream, boolean topAttributesOnly) throws SerializationException - Throws:
- SerializationException
 
- 
deserializeXMLpublic DeserializationContext deserializeXML(Reader streamReader, boolean topAttributesOnly) throws SerializationException - Throws:
- SerializationException
 
- 
transcodeToXMLpublic String transcodeToXML(InputStream binary, XMLSerializer serializer) throws SerializationException This function will take serialized data and return it in uncompressed XML format. If the data is already in XML format, it will simple be returned as a string If it is in binary format, it will be transcoded first. The stream will be automatically uncompressed if necessary.- Throws:
- SerializationException
 
- 
lookupHandlerFinds the deserialization handler registered for the given element name.
- 
deserializeMultiplepublic List<DeserializationContext> deserializeMultiple(byte[] bytes, int count) throws SerializationException Special version of deserialization which will deserialize multiple copies of the serialized objects. More efficient than calling deserialize X times, as long as X is greater than one.- Throws:
- SerializationException
 
- 
getClassNameMap
 
- 
LoggerExinstead.