C#将字节数组拆分成指定长度的字节数组
/// <summary>
/// 将字节数组拆分指定长度数组
/// </summary>
/// <param name="buffer">字节数组</param>
/// <param name="blockLength">拆分成数组长度</param>
/// <returns></returns>
private List<byte[]> SplitBuffer(byte[] buffer, int blockLength)
{
List<byte[]> list = new List<byte[]>();
int offset = 0;
while (buffer.Length - offset > 0)
{
byte[] tmp = buffer.Take(offset + blockLength).Skip(offset).ToArray();
list.Add(tmp);
offset += blockLength;
}
return list;
}

浙公网安备 33010602011771号