0

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?

user207421
  • 305,947
  • 44
  • 307
  • 483
Foredoomed
  • 2,219
  • 2
  • 21
  • 39

0 Answers0