add buffer api to support 'getc' which have stdio.h style.