process read and write buffer