-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
多线程断点续传下载工具 #80
Comments
nihenlundun
added a commit
to nihenlundun/android-labs
that referenced
this issue
Apr 27, 2016
nihenlundun
added a commit
to nihenlundun/android-labs
that referenced
this issue
Apr 27, 2016
nihenlundun
added a commit
to nihenlundun/android-labs
that referenced
this issue
Apr 27, 2016
nihenlundun
added a commit
to nihenlundun/android-labs
that referenced
this issue
Apr 27, 2016
nihenlundun
added a commit
to nihenlundun/android-labs
that referenced
this issue
Apr 27, 2016
zengsn
added a commit
that referenced
this issue
Apr 28, 2016
nihenlundun
added a commit
to nihenlundun/android-labs
that referenced
this issue
May 4, 2016
nihenlundun
added a commit
to nihenlundun/android-labs
that referenced
this issue
May 4, 2016
nihenlundun
added a commit
to nihenlundun/android-labs
that referenced
this issue
May 4, 2016
nihenlundun
added a commit
to nihenlundun/android-labs
that referenced
this issue
May 4, 2016
zengsn
added a commit
that referenced
this issue
May 5, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
题目说明
本下载工具的功能有两个,一个是实现多线程下载,一个是支持断点续传。
多线程下载:将一个完整的文件分成若干个文件,然后在合并成一个完整的文件(本题目是分为三个部分)。
多线程下载文件的过程:
1、首先获得下载文件的长度;
2、根据文件长度和线程数计算每条线程下载的数据长度和下载位置;
3、使用Http的Range头字段指定每条线程从文件的什么位置开始下载,下载到什么位置为止;
4、保存文件,使用RandomAccessFile类指定每条线程从本地文件的什么位置开始写入数据。
断点续传:本题目中的断点续传功能只是将断点状态放在内存中,一旦关闭程序的话,就不能断点续传了。当点击暂停时,程序会停止下载,并将断点状态保存在内存中,当点击继续时,程序会从内存中读取断点状态,然后向服务器请求从断点开始的数据,继续下载。
The text was updated successfully, but these errors were encountered: