Jun 7, 2010 at 10:14 AM
Edited Jun 7, 2010 at 10:17 AM
I'm trying to use theDotNetZip library to decompress a .Z (UNIX compressed) file, but so far no joy.
Here's my try-out code:
// Get the stream of the source file.
using (FileStream inFile = fiFileSrc.OpenRead())
// decompress file.
using (Ionic.Zlib.DeflateStream Decompress = new Ionic.Zlib.DeflateStream(inFile, CompressionMode.Decompress))
int i = Decompress.ReadByte();
With DeflateStream I'm getting:
Ionic.Zlib.ZlibException: Bad state (invalid block type)
And with ZLibStream I'm getting:
Ionic.Zlib.ZlibException: Bad state (unknown compression method (0x1F))
as exception on the line with the ReadByte call.
I've checked and the first 2 bytes in the input file are 0x1F 0x9D which is the header for a compressed file.
I'm using DotNetZip version 18.104.22.168
What am I doing wrong?