How can I convert my Map
byte[]
, and then write it to internal storage? I currently have:
try {
I know I am subscribing to an old thread but it popped out in my google search. So I will leave my 5 cents here:
You can use org.apache.commons.lang3.SerializationUtils which has these two methods:
/**
* Serialize the given object to a byte array.
* @param object the object to serialize
* @return an array of bytes representing the object in a portable fashion
*/
public static byte[] serialize(Object object);
/**
* Deserialize the byte array into an object.
* @param bytes a serialized object
* @return the result of deserializing the bytes
*/
public static Object deserialize(byte[] bytes);