如何膨胀时zlib.NET文件? [英] How to inflate a file with zlib.NET?

查看:103
本文介绍了如何膨胀时zlib.NET文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 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.

这篇关于如何膨胀时zlib.NET文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆