marshalls data into / from a buffer