Hello Cheok, > I try to download a gz file, which contains a text > file. I try to use GZIPInputStream, to unzip from the > input stream of HttpMethod, but get a corrupted > result.
> while(gZipInputStream.read(data, 0,
> data.length) != -1) {
> s.append(new String(data));
> }
Why do you convert binary data to characters here?
> /*
> *However, if I download manually and use
> GZIPInputStream to extract read
> *the file, with no HttpClient involvement, no
> problem.
> *
> // Transfer bytes from the compressed file to
> the output file
> byte[] buf = new byte[1024];
> int len;
> while ((len = gzipInputStream.read(buf)) > 0)
> {
> out.write(buf, 0, len);
> }
There is no binary to character conversion here.
hope that helps,
Roland
smime.p7s
Description: S/MIME Cryptographic Signature
