private final int hash;
public MarshalledObject(Object obj) throws IOException {
ByteArrayOutputStream objStream = new ByteArrayOutputStream();
MarshalledObjectOutputStream moStream = new MarshalledObjectOutputStream(objStream);
moStream.writeObject(obj);
moStream.flush();
objBytes = objStream.toByteArray();
locBytes = moStream.getLocBytes();
// calculate hash code