Read buffer to set_contents_from_string