Android更快的下载文件与多线程 [英] Android faster download of files with Multi thread
问题描述
我正在开发一个需要下载大型视频文件(300-500MB)的应用程序。
我想知道是否有办法加快使用多个文件下载单个文件线程。
我在TubeMate这样的应用程序上看到这种类型的实现,但是我无法理解用于实现它的代码。
我不需要你的代码我只需要一个起点,像一篇关于这个的文章或教程,tks。
I'm working on an app that requires downloading of big video files (300-500MB).
I would like to know if there's a way to speed up the download of a single file using multi-threading.
I've saw this type of implementation on applications like TubeMate, but I clueless about the code used to achieve it.
I don't need you to code for me :) I just need a starting point, like an article or tutorial about this, tks.
推荐答案
无论找到一个库函数,您也可以自己编写脚本来处理部分下载。
Regardless of finding a library function, you could also make your own script to handle partial downloads.
例如,在PHP中,可以使用fopen(),fread()...函数在服务器上打开流,将文件查找到特定位置,并将字节传送到请求者。文件偏移量和块长度参数将由客户端使用POST或GET方法设置。
For example, in PHP, you can use the fopen(), fread()... functions to open a stream on the server, seek the file to a particular position and transmit bytes to the requester. File offset and chunk length parameters would be set by the client using POST or GET methods.
检查这个链接。也许这可以帮助你一点点。
Check this link. Maybe it helps you a little bit.
另一方面,如果您无法访问服务器,而您只希望改善任何互联网的下载那么您可以查找 HTTP范围标题或这里。
If, on the other hand, you don't have access to the server, and you just want to improve downloads from any Internet site, then you could look up for HTTP range header or here.
这篇关于Android更快的下载文件与多线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!