Most streams are backed by a memory buffer. Create common base classes for this functionality to avoid code duplication.