Java: resume Download in URLConnection

后端 未结 2 930
借酒劲吻你
借酒劲吻你 2020-11-28 10:51

I wrote a program that downloads some files from some servers.
Currently program works properly.
But I want to add resume support to it.
I\'m doing it like this

相关标签:
2条回答
  • 2020-11-28 11:16

    Try:

    connection.setRequestProperty("Range", "bytes=" + fcheck.length() + "-");
    

    Lowercase the range specifier per the spec. Also, if your partial file was 500 bytes, that means your byte range that you have is 0-499, and you want 500+.

    0 讨论(0)
  • 2020-11-28 11:40

    The problem is in (fcheck.length() - 1): this should be fcheck.length().

    0 讨论(0)
提交回复
热议问题