我想压缩一些数据,所以我想我会通过放气来运行流
它从 304 字节变为 578 字节。那是 1.9 倍大。我试图压缩它.....我在这里做错了什么?
using (MemoryStream ms2 = new MemoryStream())
using (var ms = new DeflateStream(ms2, CompressionMode.Compress, true))
{
ms.WriteByte(1);
ms.WriteShort((short)txtbuf.Length);
ms.Write(txtbuf, 0, txtbuf.Length);
ms.WriteShort((short)buf2.Length);
ms.Write(buf2, 0, buf2.Length);
ms.WriteShort((short)buf3.Length);
ms.Write(buf3, 0, buf3.Length);
ms.Flush();
result_buf = ms2.ToArray();
}