This commit is contained in:
1 parent
123f86aa27
commit
403e19f568
1 file changed
+9
-1
@@ -105,7 +105,7 @@ public class DownloadManager {
|
||||
mProgress = PublishSubject.create();
|
||||
}
|
||||
|
||||
public void start(ResponseBody body) throws IOException {
|
||||
private void startImpl(ResponseBody body) throws IOException {
|
||||
byte[] buffer = new byte[4096];
|
||||
mFileOutputStream = new FileOutputStream(mPath);
|
||||
mInputStream = body.byteStream();
|
||||
@@ -130,6 +130,14 @@ public class DownloadManager {
|
||||
recycle();
|
||||
}
|
||||
|
||||
public void start(ResponseBody body) {
|
||||
try {
|
||||
startImpl(body);
|
||||
} catch (Exception e) {
|
||||
mProgress.onError(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void onCancel() throws IOException {
|
||||
recycle();
|
||||
// TODO: 2017/12/6 notify?
|
||||
|
||||
Reference in new issue
Block a user