swap out a stream in-place