Serializes output into a stream that you pass in. You provide the stream and this method writes the data to it.