Replace deprecated class strstream.

This commit implements the reserved_streambuf class as a replacement for
strstream. reserved_streambuf is a minimal implementation around
basic_streambuf and provides just the needed functionality for
preserving the performance from strstream.