|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.tum.cs.commons.io.SerializationUtils
public class SerializationUtils
Utility methods for serialization.
| Constructor Summary | |
|---|---|
SerializationUtils()
|
|
| Method Summary | ||
|---|---|---|
static
|
cloneBySerialization(T t,
ClassLoader classLoader)
Returns a copy of the given object obtained by serialization and deserialization in memory. |
|
static Serializable |
deserializeFromByteArray(byte[] bytes)
Deserializes an object from byte array using the default class loader used in ObjectInputStream, i.e. if there is a method on the
current call stack whose class was loaded via a custom class loader, this
class loader is used. |
|
static Serializable |
deserializeFromByteArray(byte[] bytes,
ClassLoader classLoader)
Deserializes an object from byte array using a custom/given class loader. |
|
static int |
extractInt(byte[] bytes,
int position)
Extracts an int value from the given array position (4 bytes in big endian). |
|
static void |
insertInt(int i,
byte[] bytes,
int position)
Inserts an int value to the given position in the byte array. |
|
static byte[] |
serializeToByteArray(Serializable object)
Serializes an object to byte array |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SerializationUtils()
| Method Detail |
|---|
public static byte[] serializeToByteArray(Serializable object)
throws IOException
IOException
public static Serializable deserializeFromByteArray(byte[] bytes)
throws IOException,
ClassNotFoundException
ObjectInputStream, i.e. if there is a method on the
current call stack whose class was loaded via a custom class loader, this
class loader is used. Otherwise the default class loader is used. Also
see the documentation of ObjectInputStreams resolveClass()
method.
IOException
ClassNotFoundException
public static Serializable deserializeFromByteArray(byte[] bytes,
ClassLoader classLoader)
throws IOException,
ClassNotFoundException
classLoader - the class loader used. If this is null, the default behavior
of ObjectInputStream is used, i.e. if there is a
method on the current call stack whose class was loaded via a
custom class loader, this class loader is used. Otherwise the
default class loader is used. Also see the documentation of
ObjectInputStreams resolveClass() method.
IOException
ClassNotFoundException
public static <T extends Serializable> T cloneBySerialization(T t,
ClassLoader classLoader)
classLoader - the class loader used. If this is null, the default behavior
of ObjectInputStream is used, i.e. if there is a
method on the current call stack whose class was loaded via a
custom class loader, this class loader is used. Otherwise the
default class loader is used. Also see the documentation of
ObjectInputStreams resolveClass() method.
public static void insertInt(int i,
byte[] bytes,
int position)
public static int extractInt(byte[] bytes,
int position)
insertInt(int, byte[], int)
.
|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||