Refactor out BufferStream

Moved BufferStream to its own common file.
:+1: