博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
二进制流互转
阅读量:4584 次
发布时间:2019-06-09

本文共 750 字,大约阅读时间需要 2 分钟。

1  ///  2         /// 二进制数组转流 3         ///  4         ///  5         /// 
6 public static Stream BytesToStream(byte[] bytes) 7 { 8 Stream stream = new MemoryStream(bytes); 9 return stream;10 }11 12 /// 13 /// 流转二进制数组14 /// 15 /// 16 ///
17 public static byte[] StreamToBytes(Stream theStream)18 {19 int index;20 MemoryStream tempStream = new MemoryStream();21 while ((index = theStream.ReadByte()) != -1)22 {23 tempStream.WriteByte(((byte)index));24 }25 return tempStream.ToArray();26 }

 

转载于:https://www.cnblogs.com/liuxiaoji/p/4795521.html

你可能感兴趣的文章
Ubuntu16.04下将hadoop2.7.3源代码导入到eclipse neon中
查看>>
朝令夕改的企业不值得留恋
查看>>
springboot踩坑出坑记
查看>>
ovs源码阅读--netlink使用
查看>>
php中引用&的真正理解-变量引用、函数引用、对象引用
查看>>
cmake编译安装mysql 5.6.12
查看>>
第七章学习小结
查看>>
GS LiveMgr心跳管理类
查看>>
设计模式学习笔记(二)之观察者模式、装饰者模式
查看>>
mysql导出数据库和恢复数据库代码
查看>>
走出软件泥潭 第一回 雪上加霜
查看>>
小鸟哥哥博客 For SAE
查看>>
gui编程实践(3)--记事本界面 JMenuBar JMenu
查看>>
App测试方法总结
查看>>
51nod-1228: 序列求和
查看>>
BZOJ1303: [CQOI2009]中位数图
查看>>
2015上海马拉松线上跑感悟-人生如同一场马拉松
查看>>
北航软院2013级C#期末考试部分考题解答
查看>>
CentOS 系统中安装 ArcGIS Server10.1 一些问题及解决
查看>>
asp.net里登陆记住密码
查看>>