0

I'm downloading a file over the internet using HTTP and I would like to make a progress bar. How do I determine the size of the file I'm going to download, in bytes. I'm using an HttpURLConnection in Java, and I tried getting the Content-Length property in it, and it returned 529, even though the size of the file to be downloaded is ~200MB.

4
  • 2
    Sounds like it might be a bug on their end.
    – shmosel
    Aug 24, 2017 at 23:52
  • 2
    Take a look at this SO Post. Aug 24, 2017 at 23:53
  • Look into Apache Commons IO
    – qualebs
    Aug 24, 2017 at 23:58
  • @qualebs we've been using nio for most of our needs, and want to avoid a new library.
    – Alex Jone
    Aug 25, 2017 at 1:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.