且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何写一个流的内容转换成在.NET中另一个流?

更新时间:2023-11-03 19:57:22

关于理想的缓冲区大小:

Regarding the ideal buffer size:

当使用Read方法,它是更有效地使用的缓冲区大小相同的流,其中该内部缓冲器被设置到所需的块大小的内部缓冲器,并总是读小于块的大小。如果内部缓冲器的大小为未指定时,流构建,其默认大小为4千字节(4096字节)。

"When using the Read method, it is more efficient to use a buffer that is the same size as the internal buffer of the stream, where the internal buffer is set to your desired block size, and to always read less than the block size. If the size of the internal buffer was unspecified when the stream was constructed, its default size is 4 kilobytes (4096 bytes)."

任何流阅读过程中会使用读(字符缓冲区[],INT指数,计数),这是这句话指的是方法。

Any stream-reading process will use Read(char buffer[], int index, count), which is the method this quote refers to.

http://msdn.microsoft.com/en-us/library/9kstw824.aspx (在备注)。