Class KryoUtils

java.lang.Object
dev.voidframework.core.utils.KryoUtils

public final class KryoUtils extends Object
Kryo serializer utility methods.
Since:
1.11.0
  • Method Details

    • deserialize

      public static <T> T deserialize(byte[] serializedContent, Class<T> classType)
      Deserialize an object.
      Type Parameters:
      T - The type of the Java object
      Parameters:
      serializedContent - An array of bytes representing a serialized object
      classType - The object class type
      Returns:
      Deserialized object
      Since:
      1.11.0
    • serialize

      public static byte[] serialize(Object object)
      Serialize an object.
      Parameters:
      object - The object to serialize
      Returns:
      An array of bytes representing the serialized object
      Since:
      1.11.0
    • deserializeWithoutException

      public static <T> T deserializeWithoutException(byte[] serializedContent, Class<T> classType)
      Deserialize an object. This method will return null if an exception is thrown.
      Type Parameters:
      T - The type of the Java object
      Parameters:
      serializedContent - An array of bytes representing a serialized object
      classType - The object class type
      Returns:
      Deserialized object
      Since:
      1.11.0
    • serializeWithoutException

      public static byte[] serializeWithoutException(Object object)
      Serialize an object. This method will return an empty array if an exception is thrown.
      Parameters:
      object - The object to serialize
      Returns:
      An array of bytes representing the serialized object
      Since:
      1.11.0
    • kryo

      public static com.esotericsoftware.kryo.Kryo kryo()
      Gets the Kryo instance.
      Returns:
      Kryo instance
      Since:
      1.11.0