I’ve written a program in Java to use chunking to download large files over http. Everything is working fine but I’d like to add a progress bar which I can’t do unless I get the total length of the file. Is there any way to do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the server provides a
Content-Lengthheader field, then that’s easy. If it doesn’t, then you’re out of luck.Reasonable server implementations provide
Content-Lengthwhen the content is static and has a known size. If the content is dynamically generated, then it’s impossible to know the length a priori, at least without making two passes through the data.