2016-04-21 20:28:01 -03:00
|
|
|
package us.shandian.giga.get;
|
|
|
|
|
2017-06-28 07:27:32 +02:00
|
|
|
public interface DownloadManager {
|
|
|
|
int BLOCK_SIZE = 512 * 1024;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Start a new download mission
|
|
|
|
*
|
|
|
|
* @param url the url to download
|
|
|
|
* @param location the location
|
|
|
|
* @param name the name of the file to create
|
|
|
|
* @param isAudio true if the download is an audio file
|
|
|
|
* @param threads the number of threads maximal used to download chunks of the file. @return the identifier of the mission.
|
2017-01-10 11:41:24 +01:00
|
|
|
*/
|
2017-06-28 07:27:32 +02:00
|
|
|
int startMission(String url, String location, String name, boolean isAudio, int threads);
|
2017-01-10 11:41:24 +01:00
|
|
|
|
2017-06-28 07:27:32 +02:00
|
|
|
/**
|
|
|
|
* Resume the execution of a download mission.
|
|
|
|
*
|
|
|
|
* @param id the identifier of the mission to resume.
|
|
|
|
*/
|
|
|
|
void resumeMission(int id);
|
2017-01-10 11:41:24 +01:00
|
|
|
|
2017-06-28 07:27:32 +02:00
|
|
|
/**
|
|
|
|
* Pause the execution of a download mission.
|
|
|
|
*
|
|
|
|
* @param id the identifier of the mission to pause.
|
2017-01-10 11:41:24 +01:00
|
|
|
*/
|
2017-06-28 07:27:32 +02:00
|
|
|
void pauseMission(int id);
|
2017-01-10 11:41:24 +01:00
|
|
|
|
2017-06-28 07:27:32 +02:00
|
|
|
/**
|
|
|
|
* Deletes the mission from the downloaded list but keeps the downloaded file.
|
|
|
|
*
|
|
|
|
* @param id The mission identifier
|
2017-01-10 11:41:24 +01:00
|
|
|
*/
|
2017-06-28 07:27:32 +02:00
|
|
|
void deleteMission(int id);
|
2017-01-10 11:41:24 +01:00
|
|
|
|
2017-06-28 07:27:32 +02:00
|
|
|
/**
|
|
|
|
* Get the download mission by its identifier
|
|
|
|
*
|
|
|
|
* @param id the identifier of the download mission
|
|
|
|
* @return the download mission or null if the mission doesn't exist
|
2017-01-10 11:41:24 +01:00
|
|
|
*/
|
2017-06-28 07:27:32 +02:00
|
|
|
DownloadMission getMission(int id);
|
2017-01-10 11:41:24 +01:00
|
|
|
|
2017-06-28 07:27:32 +02:00
|
|
|
/**
|
|
|
|
* Get the number of download missions.
|
|
|
|
*
|
|
|
|
* @return the number of download missions.
|
2017-01-10 11:41:24 +01:00
|
|
|
*/
|
2017-06-28 07:27:32 +02:00
|
|
|
int getCount();
|
2017-01-10 11:41:24 +01:00
|
|
|
|
2016-04-21 20:28:01 -03:00
|
|
|
}
|