}
@Override
public ByteBuffer objectToBuffer(Object obj) throws Exception
{
ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream(128);
ObjectOutputStream out = new ObjectOutputStream(baos);
out.writeShort(versionInt);
if (trace) log.trace("Wrote version " + versionInt);
//now marshall the contents of the object
defaultMarshaller.objectToObjectStream(obj, out);
out.close();
// and return bytes.
return new ByteBuffer(baos.getRawBuffer(), 0, baos.size());
}