a stronger read and write functions

add read and wirte functions with two versions.  nobuffer version and
with buffer version