Stream read/write working implementation