How can I split (copy) a Stream in .NET?

后端 未结 7 2288
北荒
北荒 2020-12-03 11:59

Does anyone know where I can find a Stream splitter implementation?

I\'m looking to take a Stream, and obtain two separate streams that can be independently read a

相关标签:
7条回答
  • 2020-12-03 12:27

    This could be tricky without risking keeping everything buffered in memory (if the streams are at BOF and EOF respectively).

    I wonder whether it isn't easier to write the stream to disk, copy it, and have two streams reading from disk, with self-deletion built into the Close() (i.e. write your own Stream wrapper around FileStream).

    0 讨论(0)
提交回复
热议问题