No, stdout and stderr will not be changed, and yes, parameters are passed by value.
The variable "buffer" will be set equal to stdout, meaning buffer will point to the same object at first. When buffer is changed to point to a new object, the old stdout reference will still point to the old object.