ObjectOutputStream oos = new ObjectOutputStream(baos);
objectToObjectStream(o, oos);
oos.flush();
oos.close();
baos.close();
byte[] b = baos.toByteArray();
return new ByteBufferImpl(b, 0, b.length);
}
@Override
public Object objectFromByteBuffer(byte[] buf, int offset, int length) throws IOException, ClassNotFoundException {