Class SerializerUtil


  • public final class SerializerUtil
    extends java.lang.Object
    Bag of utilities for serialization.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object cloneObject​(java.lang.Object object)
      Clones the given object by serializing it to bytes and then deserializing it.
      static java.lang.Object deserializeBase64Object​(java.lang.String encdata)
      Deserializes the given object from Base64 String.
      static java.lang.Object deserializeBinaryObject​(byte[] bytes)
      Deserializes the given object from bytes.
      static java.lang.Object deserializeXmlObject​(java.lang.String str, boolean validate)
      Deserializes the given object from xml.
      static java.lang.String serializeBase64Object​(java.lang.Object object)
      Serializes the given object to Base64 string.
      static byte[] serializeBinaryObject​(java.lang.Object object)
      Serializes the given object to bytes.
      static java.lang.String serializeXmlObject​(java.lang.Object object, boolean includeHeader)
      Serializes the given object to xml.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • serializeBinaryObject

        public static byte[] serializeBinaryObject​(java.lang.Object object)
        Serializes the given object to bytes.
        Parameters:
        object - The object to serialize
        Returns:
        The bytes
        See Also:
        for a list of supported types
      • deserializeBinaryObject

        public static java.lang.Object deserializeBinaryObject​(byte[] bytes)
        Deserializes the given object from bytes.
        Parameters:
        bytes - The bytes to deserialize
        Returns:
        The object
        See Also:
        for a list of supported types
      • serializeBase64Object

        public static java.lang.String serializeBase64Object​(java.lang.Object object)
        Serializes the given object to Base64 string.
        Parameters:
        object - The object to serialize
        Returns:
        The Base64 string
        Since:
        1.4
        See Also:
        for a list of supported types
      • deserializeBase64Object

        public static java.lang.Object deserializeBase64Object​(java.lang.String encdata)
        Deserializes the given object from Base64 String.
        Parameters:
        encdata - The string to deserialize
        Returns:
        The object
        Since:
        1.4
        See Also:
        for a list of supported types
      • serializeXmlObject

        public static java.lang.String serializeXmlObject​(java.lang.Object object,
                                                          boolean includeHeader)
        Serializes the given object to xml.
        Parameters:
        object - The object to serialize
        includeHeader - True if we are to include the xml header.
        Returns:
        The xml
        See Also:
        for a list of supported types
      • deserializeXmlObject

        public static java.lang.Object deserializeXmlObject​(java.lang.String str,
                                                            boolean validate)
        Deserializes the given object from xml.
        Parameters:
        str - The xml to deserialize
        validate - True if we are to validate the xml
        Returns:
        The object
        See Also:
        for a list of supported types
      • cloneObject

        public static java.lang.Object cloneObject​(java.lang.Object object)
        Clones the given object by serializing it to bytes and then deserializing it.
        Parameters:
        object - The object.
        Returns:
        A clone of the object