Commit 05e41da5 authored by qq247321453's avatar qq247321453

contentLength

parent 226796ec
......@@ -102,6 +102,9 @@ public class DownloadUtil {
try {
is = response.body().byteStream();
long total = response.body().contentLength();
if(contentLength > 0 && total != contentLength){
listener.onDownloadFailed(new Exception("file length[" + total + "] < " + contentLen));
} else {
out = new FileOutputStream(file);
long sum = 0;
while ((len = is.read(buf)) != -1) {
......@@ -113,6 +116,7 @@ public class DownloadUtil {
}
out.flush();
saved = true;
}
} catch (Exception ex) {
listener.onDownloadFailed(ex);
} finally {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment