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