public class SerializationUtil
extends java.lang.Object
Modifier and Type | Method and 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.
|
public static byte[] serializeToBytes(java.lang.Object obj)
HadoopConfigurable
, its Hadoop configuration will
be serialized into a SerializableConfiguration
.obj
- object to serializepublic static byte[] serializeToBytes(java.lang.Object obj, java.util.function.Function<org.apache.hadoop.conf.Configuration,SerializableSupplier<org.apache.hadoop.conf.Configuration>> confSerializer)
HadoopConfigurable
, the confSerializer will be used
to serialize Hadoop configuration used by the object.obj
- object to serializeconfSerializer
- serializer for the Hadoop configurationpublic static <T> T deserializeFromBytes(byte[] bytes)
public static java.lang.String serializeToBase64(java.lang.Object obj)
public static <T> T deserializeFromBase64(java.lang.String base64)