public class XmlSerializer extends Object implements Serializer
XMLEncoder
and XMLDecoder
to serialize
and deserialize, respectively.
NOTE: The JavaBeans XMLEncoder/XMLDecoder only successfully encode/decode objects when they are
JavaBeans compatible!Constructor and Description |
---|
XmlSerializer() |
Modifier and Type | Method and Description |
---|---|
Object |
deserialize(byte[] serialized)
Deserializes the specified
serialized source back into an Object by using a
ByteArrayInputStream to wrap the argument and then decode this
stream via an XMLDecoder , where the
readObject call results in the original Object to return. |
byte[] |
serialize(Object source)
Serializes the specified
source into a byte[] array by using the
XMLEncoder to encode the object out to a
ByteArrayOutputStream , where the resulting byte[] array is returned. |
public XmlSerializer()
public byte[] serialize(Object source)
source
into a byte[] array by using the
XMLEncoder
to encode the object out to a
ByteArrayOutputStream
, where the resulting byte[] array is returned.serialize
in interface Serializer
source
- the Object to convert into a byte[] array.public Object deserialize(byte[] serialized)
serialized
source back into an Object by using a
ByteArrayInputStream
to wrap the argument and then decode this
stream via an XMLDecoder
, where the
readObject
call results in the original Object to return.deserialize
in interface Serializer
serialized
- the byte[] array representation of the XML encoded output.Copyright © 2004–2016 The Apache Software Foundation. All rights reserved.