C# BufferedStream 与MemoryStream 的区别
来源:互联网 发布:dota2反和谐号淘宝 编辑:程序博客网 时间:2024/05/17 19:19
BufferedStream is just a buffer over an existing stream. MemoryStream is a buffer for the whole stream - it isn't chained to another one. You can ask it to write itself to another stream at any time, but that's not the same thing.
One of the principle reasons for buffering is to avoid frequent writes to expensive resources. However, that doesn't mean you want to buffer all the data in memory - just enough to avoid very small writes. For example, if FileStream didn't have its own buffering strategy, then wrapping it in BufferedStream could end up with a buffer of only 8K even if you write megabytes of data. As pointed out in the comments though, FileStream has enough buffering that using BufferedStream in conjunction with it is pointless.
大概的意思是,两个都是缓冲区,BufferedStream并不是将所有内容都存放到内存中,而MemoryStream则是。BufferedStream必须跟其他流如FileStream结合使用,而MemoryStream则不用,虽然可以把MemoryStream转换为其他流。
- C# BufferedStream 与MemoryStream 的区别
- 笔记6:vb.net的内存数据流MemoryStream、缓冲数据流BufferedStream
- MemoryStream 的GetBuffer() 和 ToArray()的区别
- C# MemoryStream和BinaryFormatter
- C# MemoryStream和BinaryFormatter
- C# MemoryStream和BinaryFormatter
- C# MemoryStream源代码剖析
- C# MemoryStream和BinaryFormatter
- C# MemoryStream类
- C#认识、理解和运用 BufferedStream
- C#认识、理解和运用 BufferedStream
- 使用MemoryStream与FileStream
- 使用MemoryStream与FileStream
- MemoryStream类——c#
- MemoryStream的应用
- MemoryStream 的一些例子
- 关于MemoryStream的使用
- java 使用FileInputStream,FileReader,BufferedStream的例子
- Java集合框架总结
- android 虚拟机
- XNA--Object Transformation
- Linux内核的Oops问题详解
- 动态链接库的创建及使用
- C# BufferedStream 与MemoryStream 的区别
- 性能测试新手误区
- 重构36计(25-30)
- virtual destructor问题
- Linux ssh 配置
- vc 消息映射宏的种类
- 设计包含min函数的栈O(1)时间复杂度(笔试)
- spring c3p0的配置参数说明
- swap无异常实现