Use CopyFrom to copy data to the stream from a different stream. Using CopyFrom eliminates the need for the user to create, read into, write from, and free a buffer when copying data.

CopyFrom copies Count bytes from the stream specified by Source into the stream. It then moves the current position by Count bytes, and returns the number of bytes copied.

If Count is 0, CopyFrom sets Source position to 0 before reading and then copies the entire contents of Source into the stream. If Count is greater than or less than 0, CopyFrom reads from the current position in Source.