如何膨胀时zlib.NET文件?文件、zlib、NET

2023-09-03 11:41:54 作者:浅笑°Sunshine

我使用的是 zlib.NET 库来制造通胀,这是文件COM pressed由zlib的(在Linux中,也许)。下面是我在做什么:

I'm using the zlib.NET library to try and inflate files that are compressed by zlib (on a Linux box, perhaps). Here's what I'm doing:

zlib.ZInputStream zinput =
    new zlib.ZInputStream(File.Open(path, FileMode.Open, FileAccess.Read));

while (stopByte != (data = zinput.ReadByte()))
{
  // check data here
}

zinput.Close();

数据字节符合COM pressed数据字节,所以我必须做一些错误的。

The data bytes match the compressed data bytes, so I must be doing something wrong.

推荐答案

看来我做了假设所有虚拟方法进行重写的错误,这是情况并非如此。我是用zlib.ZInputStream.ReadByte(),这仅仅是继承Stream.ReadByte(),它没有做任何充气。

It appears I made the mistake of assuming all virtual methods were overridden, which wasn't the case. I was using zlib.ZInputStream.ReadByte(), which is just the inherited Stream.ReadByte(), which doesn't do any inflate.

我用zlib.ZInputStream.Read()来代替,而它的工作像它应该。

I used zlib.ZInputStream.Read() instead, and it worked like it should.