当前位置:网站首页>Convert binary stream to byte array
Convert binary stream to byte array
2022-07-03 03:15:00 【yc_ one thousand two hundred and twenty-four】
/// <summary>
/// Convert binary stream to byte array
/// </summary>
/// <param name="_stream"></param>
/// <returns></returns>
private byte[] StreamtoBytes(Stream _stream)
{
byte[] buff;
int rlen;
MemoryStream _ms;
if (_stream != null)
{
buff = new byte[1024];
rlen = 0;
_ms = new MemoryStream();
while ((rlen = _stream.Read(buff, 0, 1024)) > 0)
{
_ms.Write(buff, 0, rlen);
}
buff = _ms.ToArray();
_ms.Close();
_ms.Dispose();
return buff;
}
return null;
}
边栏推荐
- Installation and use of memory leak tool VLD
- The idea setting code is in UTF-8 idea Properties configuration file Chinese garbled
- 模糊查詢時報錯Parameter index out of range (1 > number of parameters, which is 0)
- Reset or clear NET MemoryStream - Reset or Clear . NET MemoryStream
- From C to capable -- use the pointer as a function parameter to find out whether the string is a palindrome character
- Do you really understand relays?
- Left connection, inner connection
- Can I use read-only to automatically implement properties- Is read-only auto-implemented property possible?
- VS 2019 配置tensorRT生成engine
- Edit and preview in the back pipe to get the value writing method of the form
猜你喜欢

900W+ 数据,从 17s 到 300ms,如何操作

Summary of determinant knowledge points in Chapter 1 of Linear Algebra (Jeff's self perception)

Spark on yarn resource optimization ideas notes

umi 路由拦截(简单粗暴)

On the adjacency matrix and adjacency table of graph storage

Installation and use of memory leak tool VLD

docker安装redis

【PyG】理解MessagePassing过程,GCN demo详解

I2C subsystem (II): I3C spec
![45 lectures on MySQL [index]](/img/f6/70be00028908cbd9ed7f2c77687cee.png)
45 lectures on MySQL [index]
随机推荐
Distributed transaction
3D drawing example
Last update time of all sqlserver tables
The difference between componentscan and componentscans
Unity3d RPG implementation (medium)
一文带你了解 ZigBee
New programmers use the isXXX form to define Boolean types in the morning, and are discouraged in the afternoon?
VS code配置虚拟环境
The series of hyperbolic function in daily problem
The idea setting code is in UTF-8 idea Properties configuration file Chinese garbled
umi 路由拦截(简单粗暴)
docker安装redis
MySql实战45讲【索引】
Anhui University | small target tracking: large-scale data sets and baselines
PAT乙级常用函数用法总结
TCP handshake three times and wave four times. Why does TCP need handshake three times and wave four times? TCP connection establishes a failure processing mechanism
Creation and destruction of function stack frame
I2C 子系统(一):I2C spec
BigVision代码
后管中编辑与预览获取表单的值写法