Class XMLDeserializer
- java.lang.Object
- 
- com.inductiveautomation.ignition.common.xmlserialization.deserialization.XMLDeserializer
 
- 
 public class XMLDeserializer extends java.lang.Object
- 
- 
Field SummaryFields Modifier and Type Field Description protected ClassNameResolverclassNameMapstatic java.lang.ThreadLocal<Version>FRAMEWORK_VERSIONWill hold the version that the data currently being deserialized was found to be serialized in, if possible.protected java.util.Map<java.lang.String,DeserializationHandler>instanceHandlersprotected LoggerExlog
 - 
Constructor SummaryConstructors Constructor Description XMLDeserializer()XMLDeserializer(ClassNameResolver resolver)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddHandler(DeserializationHandler handler)DeserializationContextdeserialize(byte[] bytes)Deserialize the bytes.static java.lang.Objectdeserialize(XMLDeserializer deser, byte[] data, org.apache.log4j.Logger log)Deprecated.static java.lang.Objectdeserialize(XMLDeserializer deser, byte[] data, org.slf4j.Logger log)DeserializationContextdeserialize(java.io.InputStream is)Deserialize an object graph from an input stream.DeserializationContextdeserialize(java.io.Reader streamReader)Deserialize an object graph from a reader.DeserializationContextdeserialize(java.lang.String xml)Deserialize an object graph from a reader.DeserializationContextdeserializeBinary(byte[] bytes)Deserialize data from a byte[], expected to be in binary format.DeserializationContextdeserializeBinary(java.io.InputStream stream, boolean topAttributesOnly)java.util.List<DeserializationContext>deserializeMultiple(byte[] bytes, int count)Special version of deserialization which will deserialize multiple copies of the serialized objects.DeserializationContextdeserializeXML(java.io.Reader streamReader, boolean topAttributesOnly)ClassNameResolvergetClassNameMap()XMLDeserializerinitDefaults()Initializes default handlers in chaining invocation style.protected DeserializationHandlerlookupHandler(java.lang.String name)Finds the deserialization handler registered for the given element name.java.util.Map<java.lang.String,java.lang.String>readRootAttributes(byte[] bytes)Reads the top element's attributes only.java.util.Map<java.lang.String,java.lang.String>readRootAttributes(java.io.InputStream is)Reads the top element's attributes only.java.util.Map<java.lang.String,java.lang.String>readRootAttributes(java.io.Reader streamReader)java.util.Map<java.lang.String,java.lang.String>readRootAttributes(java.lang.String xml)java.lang.StringtranscodeToXML(java.io.InputStream binary, XMLSerializer serializer)This function will take serialized data and return it in uncompressed XML format.
 
- 
- 
- 
Field Detail- 
FRAMEWORK_VERSIONpublic static final java.lang.ThreadLocal<Version> FRAMEWORK_VERSION Will hold the version that the data currently being deserialized was found to be serialized in, if possible. Only non-null during deserialization.
 - 
instanceHandlersprotected java.util.Map<java.lang.String,DeserializationHandler> instanceHandlers 
 - 
classNameMapprotected ClassNameResolver classNameMap 
 - 
logprotected LoggerEx log 
 
- 
 - 
Constructor Detail- 
XMLDeserializerpublic XMLDeserializer() 
 - 
XMLDeserializerpublic XMLDeserializer(ClassNameResolver resolver) 
 
- 
 - 
Method Detail- 
deserialize@Deprecated public static java.lang.Object deserialize(XMLDeserializer deser, byte[] data, org.apache.log4j.Logger log) throws SerializationException Deprecated.- Throws:
- SerializationException
 
 - 
deserializepublic static java.lang.Object deserialize(XMLDeserializer deser, byte[] data, org.slf4j.Logger log) throws SerializationException - Throws:
- SerializationException
 
 - 
initDefaultspublic XMLDeserializer initDefaults() Initializes 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)
 - 
addHandlerpublic void addHandler(DeserializationHandler handler) 
 - 
deserializepublic DeserializationContext deserialize(byte[] bytes) throws SerializationException Deserialize 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
 
 - 
deserializepublic DeserializationContext deserialize(java.io.InputStream is) throws SerializationException Deserialize an object graph from an input stream. Gzip compression and XML vs binary encoding are automatically detected.- Throws:
- SerializationException
 
 - 
deserializepublic DeserializationContext deserialize(java.lang.String xml) throws SerializationException Deserialize an object graph from a reader. Encoding is assumed to be XML- Throws:
- SerializationException
 
 - 
deserializepublic DeserializationContext deserialize(java.io.Reader streamReader) throws SerializationException Deserialize an object graph from a reader. Encoding is assumed to be XML- Throws:
- SerializationException
 
 - 
readRootAttributespublic java.util.Map<java.lang.String,java.lang.String> readRootAttributes(java.lang.String xml) throws SerializationException- Throws:
- SerializationException
 
 - 
readRootAttributespublic java.util.Map<java.lang.String,java.lang.String> readRootAttributes(java.io.Reader streamReader) throws SerializationException- Throws:
- SerializationException
 
 - 
readRootAttributespublic java.util.Map<java.lang.String,java.lang.String> readRootAttributes(byte[] bytes) throws SerializationExceptionReads the top element's attributes only. Automatically detects GZip compression and xml vs binary format- Throws:
- SerializationException
 
 - 
readRootAttributespublic java.util.Map<java.lang.String,java.lang.String> readRootAttributes(java.io.InputStream is) throws SerializationExceptionReads the top element's attributes only. Automatically detects GZip compression and xml vs binary format.- Throws:
- SerializationException
 
 - 
deserializeBinarypublic DeserializationContext deserializeBinary(byte[] bytes) throws SerializationException Deserialize data from a byte[], expected to be in binary format. Detects GZip automaticaly.- Throws:
- SerializationException
 
 - 
deserializeBinarypublic DeserializationContext deserializeBinary(java.io.InputStream stream, boolean topAttributesOnly) throws SerializationException - Throws:
- SerializationException
 
 - 
deserializeXMLpublic DeserializationContext deserializeXML(java.io.Reader streamReader, boolean topAttributesOnly) throws SerializationException - Throws:
- SerializationException
 
 - 
transcodeToXMLpublic java.lang.String transcodeToXML(java.io.InputStream binary, XMLSerializer serializer) throws SerializationExceptionThis 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
 
 - 
lookupHandlerprotected DeserializationHandler lookupHandler(java.lang.String name) Finds the deserialization handler registered for the given element name.
 - 
deserializeMultiplepublic java.util.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
 
 - 
getClassNameMappublic ClassNameResolver getClassNameMap() 
 
- 
 
-