12-13-2009 06:05 PM
I am wondering if anyone have experience using ZLibInputStream successfully. We are developing a client / server application and the server compresses the content sent to the client using gzip, which includes the header and trailer. When I download the compressed content through a web browser it opens correctly, and also gunzip opens it correctly. However, when I try to inflate the content through the ZLibInputStream I get an error: "incorrect header check". I also tried using noWrap=true (although according to the documentation noWrap should be false if the gzip header is included), I get a "invalid block type" error.
I initialize the class the following way (inbuff contains the compressed buffer received from the server)
ByteArrayInputStream instream = new ByteArrayInputStream(inbuff);
ZLibInputStream zin = new ZLibInputStream(instream, false);
The exception is thrown at the following read call:
zin.read(buff, 0, n);
I am also wondering if anybody knows how to determine the size of the inflated buffer.
Solved! Go to Solution.