C# Stream 和 文件之间的转换
来源:互联网 发布:知乎电子书在电脑上看 编辑:程序博客网 时间:2024/06/01 15:36
/* - - - - - - - - - - - - - - - - - - - - - - - - * Stream 和 文件之间的转换 转载请注明来自 http://www.shang11.com * - - - - - - - - - - - - - - - - - - - - - - - */ /// <summary> /// 将 Stream 写入文件 /// </summary> public void StreamToFile(Stream stream,string fileName) { // 把 Stream 转换成 byte[] byte[] bytes = new byte[stream.Length]; stream.Read(bytes, 0, bytes.Length); // 设置当前流的位置为流的开始 stream.Seek(0, SeekOrigin.Begin); // 把 byte[] 写入文件 FileStream fs = new FileStream(fileName, FileMode.Create); BinaryWriter bw = new BinaryWriter(fs); bw.Write(bytes); bw.Close(); fs.Close(); }
0 0
- C# Stream 和 文件之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C# Stream 和 byte[] 之间的转换
- C#控制台 函数的参数是ref int 类型的效果
- LeetCode 125. Valid Palindrome
- Android studio 上传项目到 github 开源托管,项目更新 以及 github上的项目删除
- RGB颜色查询对照表
- 关于 Android 平台开发相关的有哪些推荐书籍?
- C# Stream 和 文件之间的转换
- ORACLE存储过程plsql创建与执行(一)
- PYTHON-正则表达式用法
- JNI方法签名规则
- JMS -- activeMQ使用
- iOS 开发 base64 加密和解密
- 日期格式的字符串转换成年月日字符串
- 浅谈Java private default protected public
- RxJava学习笔记(一)--- 基础篇