Hi,
You should use a FileOutputStream and directly stream the response body
stream instead of using a Reader and Writer (which performs
character decoding using the supplied charset and therefore corrupts
your file).
Jeroen
Bogdan Mihaila wrote:
Hello!
I try to download ZIP files with httpclient, and I want to get the response as stream, not as byte[]... It downloades the files (the sizes are Ok), but when I open the archives It gives me: "error in packed file" and "invalid bit length repeat".
I use the following code:
Reader reader = new InputStreamReader(
method.getResponseBodyAsStream(), method.getResponseCharSet());
// I use the Commons IO package
BufferedWriter out = new BufferedWriter(new FileWriter("...."));
out.write(IOUtils.toString(reader));
out.close();
What can be the problem?
Thanks in advance
---------------------------------
Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and
used cars.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]