Package org.refcodes.io
Class SerializeUtility
- java.lang.Object
-
- org.refcodes.io.SerializeUtility
-
public final class SerializeUtility extends java.lang.Object
Utility providing useful serialization methods.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.io.Serializable
toSerializable(java.lang.Object aObject)
Converts instances of common non-serializable types such asIterator
andListIterator
into serializable instances.
-
-
-
Method Detail
-
toSerializable
public static java.io.Serializable toSerializable(java.lang.Object aObject)
Converts instances of common non-serializable types such asIterator
andListIterator
into serializable instances. Testing for theSerializable
interface is not sufficient to determine whether an instance is serializable as of the special handling of theSerializable
tag interface in the JVM. Though in case the type of the instance is not tagged with theSerializable
interface, thennull
is returned. In case an instance's type provided is not supported by this method, then the instance is returned as is; it might already be serializable.- Parameters:
aObject
- The object to be turned into a serializable counterpart. In case it is not identified or supported (it might already be fully serializable), then the instance is returned unmodified.- Returns:
- The serializable counterpart of the provided instance in case the
type is supported by this method or the instance in case it is
Serializable
. In case the type of the instance is not tagged with theSerializable
interface, thennull
is returned.
-
-