stream: add read/write_all() methods to stream