Hi Ingo,
thanks for the code. It should be sufficient for anyone who needs to
undo a compression content encoding. Multiple encodings applied to an
entity are not likely, but would of course have to be addressed by a
generic library that wants to support content decoding. (we don't)
Ingo Meyer wrote:
> If anyone want's to use it one thing still not work. The deflate part!
> I have no idea about it, all works fine with gzip.
The problems you encountered with deflating are probably due to the
various options that can be set at the Inflater, which is an optional
argument to the InflaterInputStream. Have you tried the following?
Inflater infl = new Inflater(true);
infl.setInput(new byte[1]); // provide a dummy byte
encoded = new InflaterInputStream
(new ByteArrayInputStream(responseBytes), infl);
The JavaDocs of java.util.Inflater and InflaterInputStream are not
explicit about what a "default inflater" does. It might be necessary
to track down the relevant RFCs to identify the exact parameters
required for initializing the Inflater. RFC 2616, section 3.5 refers
to RFC 1950 and RFC 1951. One of them should specify whether the
"dummy byte" mentioned in the JavaDocs is part of the deflated entity
or not, if the "nowrap" option is used at all.
cheers,
Roland
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]