码迷,mamicode.com
首页 > 其他好文 > 详细

Stream Byte[] 转换

时间:2016-05-09 11:09:01      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:

public byte[] StreamToBytes(Stream stream)
{
    byte[] bytes = new byte[stream.Length];
    stream.Read(bytes, 0, bytes.Length);
    stream.Seek(0, SeekOrigin.Begin);
    return bytes;
}
  
public Stream BytesToStream(byte[] bytes)
{
    Stream stream = new MemoryStream(bytes);
    return stream;
}

Stream Byte[] 转换

标签:

原文地址:http://www.cnblogs.com/zhshlimi/p/5473206.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!