Forums Register Login

Downloading a zip file using Apache Commons HttpClient

+Pie Number of slices to send: Send
I have a situ where I'm using Apache Commons HttpClient and Commons IO to download a ZIP file from a url.



For some reason the downloaded zip file is always couple of 1000 bytes less thereby rendering the file useless.

What am I missing?

[ September 12, 2006: Message edited by: Chase Bonham ]

[ September 12, 2006: Message edited by: Chase Bonham ]

[ September 12, 2006: Message edited by: Chase Bonham ]
[ September 12, 2006: Message edited by: Chase Bonham ]
+Pie Number of slices to send: Send
Invoke flush() and close() on your output stream. Buffered streams read large amounts of data into memory so they incur fewer external reads on slow devices. Of course, that means that data may be lingering in the buffer when your program ends and never gets written.
BTW, IOUtils buffers data internally so there's no need for additional buffering.
+Pie Number of slices to send: Send
That fixed it. Thanks
Good night. Drive safely. Here's a tiny ad for the road:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 12239 times.
Similar Threads
parsing url content into string
HttpURLConnection and Redirects
download and save a file - help!
Reading XML from Web
org.apache.commons.httpclient response not getting
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:46:03.