Maybe it's just me, but the naming here seems a bit counterintuitive.  I'd expect streamin() to read from the file, and streamout() to stream out to the file??