How do I copy the contents of one stream to another?

后端 未结 13 2345
悲哀的现实
悲哀的现实 2020-11-21 22:11

What is the best way to copy the contents of one stream to another? Is there a standard utility method for this?

13条回答
  •  灰色年华
    2020-11-21 22:57

    The basic questions that differentiate implementations of "CopyStream" are:

    • size of the reading buffer
    • size of the writes
    • Can we use more than one thread (writing while we are reading).

    The answers to these questions result in vastly different implementations of CopyStream and are dependent on what kind of streams you have and what you are trying to optimize. The "best" implementation would even need to know what specific hardware the streams were reading and writing to.

提交回复
热议问题