Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 48589d1

Browse files
committedDec 18, 2016
docs(java-doc): add the java-doc for FileDownloadDatabase
1 parent 699e8b3 commit 48589d1

File tree

1 file changed

+72
-2
lines changed

1 file changed

+72
-2
lines changed
 

‎library/src/main/java/com/liulishuo/filedownloader/services/FileDownloadDatabase.java

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919

2020
import com.liulishuo.filedownloader.model.FileDownloadModel;
21+
import com.liulishuo.filedownloader.model.FileDownloadStatus;
2122

2223
import java.util.List;
2324

@@ -36,33 +37,102 @@
3637
public interface FileDownloadDatabase {
3738

3839
/**
39-
* @param id download id
40+
* Find the model which identify is {@code id}.
41+
*
42+
* @param id the download id.
4043
*/
4144
FileDownloadModel find(final int id);
4245

43-
46+
/**
47+
* Insert the model to the database.
48+
*
49+
* @param downloadModel the download model.
50+
*/
4451
void insert(final FileDownloadModel downloadModel);
4552

53+
/**
54+
* Update the data compare to the {@code downloadModel}
55+
*
56+
* @param downloadModel the download model.
57+
*/
4658
void update(final FileDownloadModel downloadModel);
4759

60+
/**
61+
* Update the batch of datum compare to the {@code downloadModelList}
62+
*
63+
* @param downloadModelList the list of model.
64+
*/
4865
void update(final List<FileDownloadModel> downloadModelList);
4966

67+
/**
68+
* Remove the model which identify is {@code id}.
69+
*
70+
* @param id the download id.
71+
* @return {@code true} if succeed to remove model from the database.
72+
*/
5073
boolean remove(final int id);
5174

75+
/**
76+
* Clear all models in this database.
77+
*/
5278
void clear();
5379

80+
/**
81+
* Update the data because of the download status alternative to {@link FileDownloadStatus#connected}.
82+
*
83+
* @param model the data in the model will be updated.
84+
* @param total the new total bytes.
85+
* @param etag the new etag.
86+
* @param fileName the new file name.
87+
*/
5488
void updateConnected(final FileDownloadModel model, final long total, final String etag,
5589
final String fileName);
5690

91+
/**
92+
* Update the data because of the download status alternative to {@link FileDownloadStatus#progress}.
93+
*
94+
* @param model the data in the model will be updated.
95+
* @param soFar the new so far bytes.
96+
*/
5797
void updateProgress(final FileDownloadModel model, final long soFar);
5898

99+
/**
100+
* Update the data because of the download status alternative to {@link FileDownloadStatus#error}.
101+
*
102+
* @param model the data in the model will be updated.
103+
* @param throwable the new exception.
104+
* @param sofar the new so far bytes.
105+
*/
59106
void updateError(final FileDownloadModel model, final Throwable throwable, final long sofar);
60107

108+
/**
109+
* Update the data because of the download status alternative to {@link FileDownloadStatus#retry}.
110+
*
111+
* @param model the data in the model will be updated.
112+
* @param throwable the new exception.
113+
*/
61114
void updateRetry(final FileDownloadModel model, final Throwable throwable);
62115

116+
/**
117+
* Update the data because of the download status alternative to {@link FileDownloadStatus#completed}.
118+
*
119+
* @param model the data in the model will be updated.
120+
* @param total the new total bytes.
121+
*/
63122
void updateComplete(final FileDownloadModel model, final long total);
64123

124+
/**
125+
* Update the data because of the download status alternative to {@link FileDownloadStatus#paused}.
126+
*
127+
* @param model the data in the model will be updated.
128+
* @param sofar the new so far bytes.
129+
*/
65130
void updatePause(final FileDownloadModel model, final long sofar);
66131

132+
/**
133+
* Update the data because of the download status alternative to {@link FileDownloadStatus#pending}.
134+
*
135+
* @param model the data in the model will be updated.
136+
*/
67137
void updatePending(final FileDownloadModel model);
68138
}

0 commit comments

Comments
 (0)
Failed to load comments.