public final class SerializedObjectExtensions extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static Logger |
LOGGER
The LOGGER.
|
| Constructor and Description |
|---|
SerializedObjectExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
readSerializedObjectFromFile(File file)
Reads the object from the given file.
|
static <T> byte[] |
toByteArray(T object)
The Method toByteArray() serialize an Object to byte array.
|
static Object |
toObject(byte[] byteArray)
The Method toObject() converts the given byte array into an Object.
|
static boolean |
writeSerializedObjectToFile(Object obj,
File file)
Writes the given object to the given File.
|
protected static final Logger LOGGER
public static Object readSerializedObjectFromFile(File file) throws IOException, ClassNotFoundException
file - In that file is the object saved.IOException - Signals that an I/O exception has occurred.ClassNotFoundException - is thrown when a class is not found in the classloader or no definition for the
class with the specified name could be found.public static <T> byte[] toByteArray(T object)
throws IOException
T - the generic type of the given objectobject - The Object to convert into a byte array.IOException - Signals that an I/O exception has occurred.public static Object toObject(byte[] byteArray) throws IOException, ClassNotFoundException
byteArray - The byte array to convert into an Object.IOException - Signals that an I/O exception has occurred.ClassNotFoundException - is thrown when a class is not found in the classloader or no definition for the
class with the specified name could be found.public static boolean writeSerializedObjectToFile(Object obj, File file) throws IOException
obj - The object to write to the File.file - In this file will be the object saved.IOException - Signals that an I/O exception has occurred.Copyright © 2015–2018 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.