>>> how do i convert an hash map into a byte array(being able to restore
>>> this later , without losing data)?Serialization !
>
> can you send me link where to find out how?
private static byte[] serialize(Object o) throws IOException {
ByteArrayOutputStream ba = new ByteArrayOutputStream(1000);
ObjectOutputStream oba = new ObjectOutputStream(ba);
oba.writeObject(o);
return ba.toByteArray();
}
private static Object deserialize(byte[] b) throws IOException,
ClassNotFoundException {
ByteArrayInputStream ba = new ByteArrayInputStream(b);
ObjectInputStream oba = new ObjectInputStream(ba);
return oba.readObject();
}
All objects need to be serializable for this to work though !
Arne
andrewzzz - 11 Nov 2006 20:01 GMT
> >>> how do i convert an hash map into a byte array(being able to restore
> >>> this later , without losing data)?Serialization !
[quoted text clipped - 16 lines]
>
> Arne
thanks so much! I will try now!