public class SerializationUtils extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
SerializationUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
deserialize(byte[] bytes)
Deserializes object from byte array
|
static <T> T |
deserialize(InputStream is)
Deserializes object from InputStream
|
static <T> T |
fromByteArray(byte[] bytes)
Deserializes object from byte array
|
static <T> T |
readObject(File file) |
static <T> T |
readObject(InputStream is)
Reads an object from the given input stream
|
static void |
saveObject(Object toSave,
File saveTo) |
static void |
serialize(Serializable object,
OutputStream os)
Writes the object to the output stream
THIS DOES NOT FLUSH THE STREAM
|
static byte[] |
toByteArray(Serializable toSave)
Converts the given object to a byte array
|
static void |
writeObject(Serializable toSave,
OutputStream writeTo)
Writes the object to the output stream
THIS DOES NOT FLUSH THE STREAM
|
public static <T> T readObject(File file)
public static <T> T readObject(InputStream is)
is - the input stream to read frompublic static byte[] toByteArray(Serializable toSave)
toSave - the object to savepublic static <T> T fromByteArray(byte[] bytes)
T - bytes - public static <T> T deserialize(byte[] bytes)
T - bytes - public static <T> T deserialize(InputStream is)
T - bytes - public static void writeObject(Serializable toSave, OutputStream writeTo)
toSave - the object to savewriteTo - the output stream to write topublic static void serialize(Serializable object, OutputStream os)
toSave - the object to savewriteTo - the output stream to write toCopyright © 2022. All rights reserved.