-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Customizable Component
Jacksgong edited this page Jun 4, 2017
·
7 revisions
From now on, FileDownloader support following components to be customized by yourself:
| Name | Interface | Default Impl |
|---|---|---|
| Connection | FileDownloadConnection | FileDownloadUrlConnection |
| OutputStream | FileDownloadOutputStream | FileDownloadRandomAccessFile |
| Database | FileDownloadDatabase | DefaultDatabaseImpl |
| ConnectionCountAdapter | ConnectionCountAdapter | DefaultConnectionCountAdapter |
Just create your own DownloadMgrInitialParams.InitCustomMaker and put those customized components to it, finally init the FileDownloader with it: FileDownloader#init
Implementing your own customized component if you want. P.S: You can refer the default-impl.
Putting it into FileDownloader when you init the FileDownloader:
FileDownloader.init(getApplicationContext(), new DownloadMgrInitialParams.InitCustomMaker()
.database(/*You can put your customized database component here*/)
.outputStreamCreator(/*You can put your customized output-stream component here*/)
.connectionCreator(/*You can put your customized connection component here*/));If you want to use okhttp as your connection component, the simplest way is this repo.
- Initialization
- Start downloading
- Pause or Stop
- Get the internal stored data
- Customizable Component
- Interface