ENH: Use stringstream instead of fstream as buffer