}
ClassDefinition cd = context.lookupOrRegisterClassDefinition(p);
PortableDataOutput output = (PortableDataOutput) out;
DynamicByteBuffer headerBuffer = output.getHeaderBuffer();
int pos = headerBuffer.position();
out.writeInt(pos);
headerBuffer.putInt(cd.getFactoryId());
headerBuffer.putInt(cd.getClassId());
headerBuffer.putInt(cd.getVersion());
DefaultPortableWriter writer = new DefaultPortableWriter(this, output, cd);
p.writePortable(writer);
writer.end();
}