This commit is contained in:
@@ -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