Questions and ZLibInputStream compatibility

I wonder if anyone have experience using ZLibInputStream with success. We develop a client / server application and the server compresses the content sent to the client by using gzip, which includes the header and trailer. When I download the content compressed using a web browser it opens correctly, and also gunzip it opens correctly. However, when I try to inflate the content through the ZLibInputStream, I get an error: "incorrect header control. I also tried to use noWrap = true (although according to documentation noWrap must be false if the gzip header is included), I get an error "invalid block type.

I initialize the class in the following way (inbuff contains the server received compressed buffer)

ByteArrayInputStream instream = new ByteArrayInputStream (inbuff);

Zin ZLibInputStream = new ZLibInputStream (in-Stream, false);

The exception is thrown to the call to read the following:

Zin.Read (buff, 0, n);

I also wonder if anyone knows how to determine the size of the buffer that is inflated.

Thank you!

A gzip file is not the same as a coded Zlib stream. Try using the GzipInputStream (or whatever it's called).

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for