Class SerializationUtils


  • public class SerializationUtils
    extends java.lang.Object
    This is SerializationUtils that encapsulates common serialization operations in one spot.
    Since:
    5.0.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends java.io.Serializable>
      T
      decodeAndDeserializeObject​(byte[] object, org.apereo.cas.util.crypto.CipherExecutor cipher, java.lang.Class<T> type)
      Decode and deserialize object t.
      static <T extends java.io.Serializable>
      T
      decodeAndDeserializeObject​(byte[] object, org.apereo.cas.util.crypto.CipherExecutor cipher, java.lang.Class<T> type, java.lang.Object[] parameters)
      Decode and serialize object.
      static <T> T deserialize​(byte[] inBytes, java.lang.Class<T> clazz)
      Deserialize an object.
      static <T> T deserialize​(java.io.InputStream inputStream, java.lang.Class<T> clazz)
      Deserialize an object.
      static <T extends java.io.Serializable>
      T
      deserializeAndCheckObject​(byte[] object, java.lang.Class<T> type)
      Decode and serialize object.
      static byte[] serialize​(java.io.Serializable object)
      Serialize an object.
      static void serialize​(java.io.Serializable object, java.io.OutputStream outputStream)
      Serialize an object.
      static byte[] serializeAndEncodeObject​(org.apereo.cas.util.crypto.CipherExecutor cipher, java.io.Serializable object)
      Serialize and encode object byte [ ].
      static byte[] serializeAndEncodeObject​(org.apereo.cas.util.crypto.CipherExecutor cipher, java.io.Serializable object, java.lang.Object[] parameters)
      Serialize and encode object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SerializationUtils

        public SerializationUtils()
    • Method Detail

      • serialize

        public static byte[] serialize​(java.io.Serializable object)
        Serialize an object.
        Parameters:
        object - The object to be serialized
        Returns:
        the +byte[]+ containing the object
        Since:
        5.0.0
      • serialize

        public static void serialize​(java.io.Serializable object,
                                     java.io.OutputStream outputStream)
        Serialize an object.
        Parameters:
        object - The object to be serialized
        outputStream - The stream to receive the object
        Since:
        5.0.0
      • deserialize

        public static <T> T deserialize​(byte[] inBytes,
                                        java.lang.Class<T> clazz)
        Deserialize an object.
        Type Parameters:
        T - the type parameter
        Parameters:
        inBytes - The bytes to be de-serialized
        clazz - the clazz
        Returns:
        the object
        Since:
        5.0.0
      • deserialize

        public static <T> T deserialize​(java.io.InputStream inputStream,
                                        java.lang.Class<T> clazz)
        Deserialize an object.
        Type Parameters:
        T - the type parameter
        Parameters:
        inputStream - The stream to be de-serialized
        clazz - the clazz
        Returns:
        the object
        Since:
        5.0.0
      • serializeAndEncodeObject

        public static byte[] serializeAndEncodeObject​(org.apereo.cas.util.crypto.CipherExecutor cipher,
                                                      java.io.Serializable object,
                                                      java.lang.Object[] parameters)
        Serialize and encode object.
        Parameters:
        cipher - the cipher
        object - the object
        parameters - the parameters
        Returns:
        the byte []
        Since:
        4.2
      • serializeAndEncodeObject

        public static byte[] serializeAndEncodeObject​(org.apereo.cas.util.crypto.CipherExecutor cipher,
                                                      java.io.Serializable object)
        Serialize and encode object byte [ ].
        Parameters:
        cipher - the cipher
        object - the object
        Returns:
        the byte []
      • decodeAndDeserializeObject

        public static <T extends java.io.Serializable> T decodeAndDeserializeObject​(byte[] object,
                                                                                    org.apereo.cas.util.crypto.CipherExecutor cipher,
                                                                                    java.lang.Class<T> type,
                                                                                    java.lang.Object[] parameters)
        Decode and serialize object.
        Type Parameters:
        T - the type parameter
        Parameters:
        object - the object
        cipher - the cipher
        type - the type
        parameters - the parameters
        Returns:
        the t
        Since:
        4.2
      • decodeAndDeserializeObject

        public static <T extends java.io.Serializable> T decodeAndDeserializeObject​(byte[] object,
                                                                                    org.apereo.cas.util.crypto.CipherExecutor cipher,
                                                                                    java.lang.Class<T> type)
        Decode and deserialize object t.
        Type Parameters:
        T - the type parameter
        Parameters:
        object - the object
        cipher - the cipher
        type - the type
        Returns:
        the t
      • deserializeAndCheckObject

        public static <T extends java.io.Serializable> T deserializeAndCheckObject​(byte[] object,
                                                                                   java.lang.Class<T> type)
        Decode and serialize object.
        Type Parameters:
        T - the type parameter
        Parameters:
        object - the object
        type - the type
        Returns:
        the t
        Since:
        4.2