Package dev.voidframework.core.utils
Class KryoUtils
java.lang.Object
dev.voidframework.core.utils.KryoUtils
Kryo serializer utility methods.
- Since:
- 1.11.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Tdeserialize(byte[] serializedContent, Class<T> classType) Deserialize an object.static <T> TdeserializeWithoutException(byte[] serializedContent, Class<T> classType) Deserialize an object.static com.esotericsoftware.kryo.Kryokryo()Gets the Kryo instance.static byte[]Serialize an object.static byte[]serializeWithoutException(Object object) Serialize an object.
-
Method Details
-
deserialize
Deserialize an object.- Type Parameters:
T- The type of the Java object- Parameters:
serializedContent- An array of bytes representing a serialized objectclassType- The object class type- Returns:
- Deserialized object
- Since:
- 1.11.0
-
serialize
Serialize an object.- Parameters:
object- The object to serialize- Returns:
- An array of bytes representing the serialized object
- Since:
- 1.11.0
-
deserializeWithoutException
Deserialize an object. This method will returnnullif an exception is thrown.- Type Parameters:
T- The type of the Java object- Parameters:
serializedContent- An array of bytes representing a serialized objectclassType- The object class type- Returns:
- Deserialized object
- Since:
- 1.11.0
-
serializeWithoutException
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
-