Move entry serialization back to ByteBufWriter
I8f6bac3192a0f38b627150be4c8ea128f1e233e5 moved serialization to heap,
causing unnecessary copies, while nominally simplifying the interface.
This patch undoes that move, restoring the logic, except working on top
of a ByteBuf. This requires a bit more logic to deal with the fact we
are no longer writing to the diskEntry nor are we flipping it.
JIRA: CONTROLLER-2115
Change-Id: I1d18f99cfdb5b7e6c6548a5833c824af9f31c166
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>