com.kuka.common
Class SerializeUtil

java.lang.Object
  extended by com.kuka.common.SerializeUtil

public final class SerializeUtil
extends Object

Contains utility methods for Java serialization.


Method Summary
static Serializable deserialize(byte[] serializedObject)
          Deserializes the specified byte array into an serializable object.
static Serializable deserializeFromString(String serializedObject)
          Deserializes the specified string into an serializable object.
static byte[] serialize(Serializable toSerialize)
          Serializes the specified object into an byte array (by using the serialization mechanism of Java).
static String serializeToString(Serializable toSerialize)
          Serializes the specified object into an byte array (by using the serialization mechanism of Java) and returns the string representation of the byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

serialize

public static byte[] serialize(Serializable toSerialize)
Serializes the specified object into an byte array (by using the serialization mechanism of Java).

Parameters:
toSerialize - the object the serialize.
Returns:
byte array of the serialized object or null if the serialization failed.

deserialize

public static Serializable deserialize(byte[] serializedObject)
Deserializes the specified byte array into an serializable object.

Parameters:
serializedObject - byte array of the serialized object
Returns:
the deserialized object or null if an error occurred.

serializeToString

public static String serializeToString(Serializable toSerialize)
Serializes the specified object into an byte array (by using the serialization mechanism of Java) and returns the string representation of the byte array.

Parameters:
toSerialize - the object the serialize.
Returns:
string representation of the serialized object (= byte array) or null if the serialization failed.

deserializeFromString

public static Serializable deserializeFromString(String serializedObject)
Deserializes the specified string into an serializable object. The string must contain the serialized byte array values.

Parameters:
serializedObject - string representation of the serialized object (byte array)
Returns:
the deserialized object or null if an error occurred.


Copyright © 2019. All rights reserved.