generalized function readFrontBuffer