adding optional outbuf parameter to #read
adding outbuf #read tests