T
- the object to to serialize or deserialize.public class SerializableUtils<T extends Serializable> extends Object
Constructor and Description |
---|
SerializableUtils()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
T |
readSerializableFromFile(File file)
Loads a serialized file into the Object "T".
|
T |
readSerializableFromString(String data)
Loads a serialized String into the Object "T".
|
void |
writeSerializableToFile(File file,
T obj)
Serialize a Ojbect "T" to a file.
|
String |
writeSerializableToString(T obj)
Serialize a Ojbect "T" to a String - Base64 encoded.
|
public T readSerializableFromFile(File file) throws IOException
file
- the fileIOException
- if any failure occurs during deserialization.public void writeSerializableToFile(File file, T obj) throws IOException
file
- the file to serialize to.obj
- the Ojbect "T"IOException
- if any failures during serialization.public T readSerializableFromString(String data) throws IOException
data
- the serialized data string, assumed to be Base64 encoded.IOException
- if any failure occurs during deserialization.public String writeSerializableToString(T obj) throws IOException
obj
- the Ojbect "T"IOException
- if any failures during serialization.Copyright © 2016. All rights reserved.