I have an object called Tree:
public class Tree{
protected Node root;
public static class Node{
protected Node parent;
protected List<Node> children;
}
}
I am serializing and then deserializing it:
// build a tree
Tree t = Tree.build();
// serialize
ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
HessianOutput out = new HessianOutput(baos);
out.writeObject(t);
byte[] b = baos.toByteArray();
// deserialize
ByteArrayInputStream bais = new ByteArrayInputStream(b);
HessianInput in = new HessianInput(inputStream);
Object obj = in.readObject(); // obj becomes HashMap
I need a tree object instead of a hashmap. Can anyone figure out how it comes? Thanks in advance?