登录
首页 » Android » Android 支持断点续传功能的下载demo源码

Android 支持断点续传功能的下载demo源码

于 2022-10-23 发布 文件大小:588.41 kB
0 148
下载积分: 2 下载次数: 1

代码说明:

Android 支持断点续传功能的下载demo源码,并结合了数据库来实现,在download.db数据库下创建一个download_info表存储下载信息,利用Http协议进行多线程下载,从头开始的全文下载;1,从某字节开始的下载(bytes=27000-);2,从某字节开始到某字节结束的下载(bytes=27000-39000),针对 bytes=27000-39000 的请求,从27000开始写数据,客户端请求的是270000之后的字节(包括bytes下标索引为270000的字节),如果设设置了Content-Length,则客户端会自动进行多线程下载。如果不希望支持多线程,则不要设置这个参数。   // Content-Length: [文件的总大小] - [客户端请求的下载的文件块的开始字节]   断点开始   // 响应的格式是:   // Content-Range: bytes [文件块的开始字节]-[文件的总大小 - 1]/[文件的总大小]

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • AystnPicture
    图片同步上传法,内有仔细的标注,利于读者学习(Image sync upload method, with annotations carefully, good for readers to learn)
    2013-10-14 23:37:21下载
    积分:1
  • contentProvider
    移动开发android的中关于contentProvider的测试,适合初学者使用(Suitable for beginners.)
    2018-11-21 15:07:04下载
    积分:1
  • Android4高级编程(第3版)英文原版
    Android4高级编程(第3版)英文原版,带书签 Professional Android 4 Application development目录INTRODUCTION . . CHAPTER 1 Hello, Android .CHAPTER 2 Getting Started .CHAPTER 3 Creating Applications and ActivitiesCHAPTER 4 Building User Interfaces . . . . CHAPTER 5 Intents and Broadcast ReceiversCHAPTER 6 Using Internet Resources . . .CHAPTER 7 Files, Saving State, and Preferences . CHAPTER 8 Databases and C
    2023-07-31 17:00:12下载
    积分:1
  • Android MultiThreadDownload多线程多任务断点续传例子源码
    Android MultiThreadDownload多线程多任务断点续传例子源码,里面包括了下载类、多线程类、进度条类、数据库操作类等,同样对大家是很有用的。这个多线程多任务的Android下载模块,代码中有丰富 注释,是初学者研究学习Android 编程技术的好范例。
    2022-04-27 16:00:39下载
    积分:1
  • FTP上传下载
    链接ftp上传下载文件,FTP封装好的工具类,对于学习FTP下载上传有很好的作用
    2023-01-26 16:40:04下载
    积分:1
  • android LinearLayout 布局实例分享
    android LinearLayout 布局 入门级实例
    2013-03-16下载
    积分:1
  • TextViewSample
    Andoid小例程,对入门相当有用!关于TextView的。(Andoid small routines for beginners very useful! About a TextView.)
    2013-07-12 01:08:22下载
    积分:1
  • android 广播和通知 实例源码
    android 广播和通知 实例源码
    2014-12-24下载
    积分:1
  • 网络下载图片01
    网络下载图片01
    2015-04-22下载
    积分:1
  • android 异步 执行 任务 例子 附讲解
    Rules::The AsyncTask instance must be created in UI thread. .execute must be invoked on the UI thread.Never call  objMyTask.onPreExecute(), objMyTask.doInBackground(), objMyTask.onProgressUpdate(),  objMyTask.onPostExecute manually.The AsyncTask can be executed only once (an exception will be thrown if a second execution is attempted.)AsyncTask have Four Main Method... onPreExecute()  doInBackground() onProgressUpdate() onPostExecute()  onPreExecute-This method is called first when you start AsyncTask using objAsync.execute().And mostly this method is use for initializing dialog(ProgressDialog,CustomDialog) and showing. doInBackground-The main purpose of AsyncTask is accomplished by this method.Any non-UI thread process is running in this method.Such as Rss Feed Reader,Image and video Uploading and Downloading.You cant handle your View in this method.Because this method is non-UI thread.While any background process is running if you want to handle UI therea are  onProgressUpdate method. after completion of process this method send result to OnPostExecute. onProgressUpdate-While backgrounding task is running ,you can handle your UI using this method .Such as status of downloading or uploading task.and this method is called from  doInBackground.Using publishProgress() you can call onProgressUpdate method to update UI while process is running. onPostExecute -This method is called after the background computation finishes.The result of background process in passed in this method as parameters.And now you can dismiss progress dialog ,to indicate that background task is completed. You can cancel AsyncTask using objAsyncTask.cancel().then you just check in doInBackground, if (isCancelled()) { break; } else {        //continue... } See this Image For more Clear.
    2013-07-05下载
    积分:1
  • 696518资源总数
  • 106174会员总数
  • 31今日下载