网络下载-断点续传原理

来源:互联网 发布:淮安java培训机构 编辑:程序博客网 时间:2024/06/05 11:45
//在多线程下载的基础上,




多点续传只是在多线程下载的基础上,每次write 之后,把 seek 指针的long 保存下来。保存到文件。




http.setRequestProperty("Range", "bytes="+start+"-"+end);




http头属性之一,Range 
- The first 500 bytes (byte offsets 0-499, inclusive):  bytes=0-         499 
- The second 500 bytes (byte offsets 500-999, inclusive):         bytes=500-999 
- The final 500 bytes (byte offsets 9500-9999, inclusive):         bytes=-500 - Or bytes=9500- 
- The first and last bytes only (bytes 0 and 9999):  bytes=0-0,-1 
- Several legal but not canonical specifications of the second 500 
bytes (byte offsets 500-999, inclusive): 
bytes=500-600,601-999 
bytes=500-700,601-999 
0 0
原创粉丝点击