//write
ByteArrayOutputStream buf = new ByteArrayOutputStream();
ObjectOutputStream o = new ObjectOutputStream(buf);
o.writeObject(s.property);
//read
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buf.toByteArray()));
A aa = (A)in.readObject();