public class FileDownloadHelper extends Object
APP_CONTEXT and OK_HTTP_CLIENT for the main process and
the filedownloader process.| Modifier and Type | Class and Description |
|---|---|
static interface |
FileDownloadHelper.ConnectionCountAdapter |
static interface |
FileDownloadHelper.ConnectionCreator |
static interface |
FileDownloadHelper.DatabaseCustomMaker |
static interface |
FileDownloadHelper.IdGenerator |
static interface |
FileDownloadHelper.OutputStreamCreator |
| Constructor and Description |
|---|
FileDownloadHelper() |
| Modifier and Type | Method and Description |
|---|---|
static Context |
getAppContext() |
static void |
holdContext(Context context) |
static boolean |
inspectAndInflowConflictPath(int id,
long sofar,
String tempFilePath,
String targetFilePath,
IThreadPoolMonitor monitor) |
static boolean |
inspectAndInflowDownloaded(int id,
String path,
boolean forceReDownload,
boolean flowDirectly) |
static boolean |
inspectAndInflowDownloading(int id,
FileDownloadModel model,
IThreadPoolMonitor monitor,
boolean flowDirectly) |
public static void holdContext(Context context)
public static Context getAppContext()
public static boolean inspectAndInflowDownloaded(int id,
String path,
boolean forceReDownload,
boolean flowDirectly)
id - the id used for filter out which task would be notified the
'completed' message if need.path - if the file with path is exist it means the relate task would
be completed.forceReDownload - whether the task is force to re-download ignore whether the file has
been exist or not.flowDirectly - true if flow the message if need directly without throw to the
message-queue.id has been downloaded.public static boolean inspectAndInflowDownloading(int id,
FileDownloadModel model,
IThreadPoolMonitor monitor,
boolean flowDirectly)
id - the id used for filter out which task would be notified the
'warn' message if need.model - the target model will be checked for judging whether it is downloading.monitor - the monitor for download-thread.flowDirectly - true if flow the message if need directly without throw to the
message-queue.model is downloading.public static boolean inspectAndInflowConflictPath(int id,
long sofar,
String tempFilePath,
String targetFilePath,
IThreadPoolMonitor monitor)
id - the id used for filter out which task would be notified the
'error' message if need.sofar - the so far bytes of the current checking-task.tempFilePath - the temp file path(file path used for downloading) for the current
checking-task.targetFilePath - the target file path for the current checking-task.monitor - the monitor for download-thread.id is refused to start, because of there is an another
running task with the same tempFilePath.