Class SerializationUtil


  • public class SerializationUtil
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T deserializeFromBase64​(java.lang.String base64)  
      static <T> T deserializeFromBytes​(byte[] bytes)  
      static java.lang.String serializeToBase64​(java.lang.Object obj)  
      static byte[] serializeToBytes​(java.lang.Object obj)
      Serialize an object to bytes.
      static byte[] serializeToBytes​(java.lang.Object obj, java.util.function.Function<org.apache.hadoop.conf.Configuration,​SerializableSupplier<org.apache.hadoop.conf.Configuration>> confSerializer)
      Serialize an object to bytes.
      • Methods inherited from class java.lang.Object

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

      • serializeToBytes

        public static byte[] serializeToBytes​(java.lang.Object obj)
        Serialize an object to bytes. If the object implements HadoopConfigurable, its Hadoop configuration will be serialized into a SerializableConfiguration.
        Parameters:
        obj - object to serialize
        Returns:
        serialized bytes
      • serializeToBytes

        public static byte[] serializeToBytes​(java.lang.Object obj,
                                              java.util.function.Function<org.apache.hadoop.conf.Configuration,​SerializableSupplier<org.apache.hadoop.conf.Configuration>> confSerializer)
        Serialize an object to bytes. If the object implements HadoopConfigurable, the confSerializer will be used to serialize Hadoop configuration used by the object.
        Parameters:
        obj - object to serialize
        confSerializer - serializer for the Hadoop configuration
        Returns:
        serialized bytes
      • deserializeFromBytes

        public static <T> T deserializeFromBytes​(byte[] bytes)
      • serializeToBase64

        public static java.lang.String serializeToBase64​(java.lang.Object obj)
      • deserializeFromBase64

        public static <T> T deserializeFromBase64​(java.lang.String base64)