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

问题描述

我正在使用库来尝试并膨胀文件被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();

数据字节与压缩数据字节匹配,因此我必须做错事。

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

推荐答案

看来我犯了一个错误,假设所有的虚拟方法被重写,这是不是这样。我使用zlib.ZInputStream.ReadByte(),这只是继承Stream.ReadByte(),它不做任何inflate。

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扩充文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 21:45