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.
Asked
Active
Viewed 616 times
0
-
2Sounds like it might be a bug on their end. – shmosel Aug 24 '17 at 23:52
-
2Take a look at this [SO Post](https://stackoverflow.com/questions/263013/java-urlconnection-how-can-i-find-out-the-size-of-a-web-file). – DevilsHnd - 退職した Aug 24 '17 at 23:53
-
Look into Apache Commons IO – qualebs Aug 24 '17 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 '17 at 01:09