为什么CopyTo会导致异常?它下面的代码运行完美,是我认为 copyto 会做的。
using (var mem = new MemoryStream())
{
using (var memin = new MemoryStream(v.body))
using (var comp = new BZip2InputStream(memin))
{
//comp.CopyTo(mem); //Non-negative number required (System.ArgumentOutOfRangeException)
var buf = new Byte[1024 * 4];
int len=0;
while ((len = comp.Read(buf, 0, buf.Length)) > 0)
{
mem.Write(buf, 0, len);
}
}