MemStream is a reader + writer stream backed by an in-memory buffer.