添加timeout处理

This commit is contained in:
huangzhuanghua
2016-05-21 18:23:11 +08:00
parent 90dab2875b
commit 547f27f19b
8 changed files with 318 additions and 319 deletions

View File

@ -45,10 +45,7 @@ public class DownloadThread extends Thread {
}
}
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
FileOutputStream fileOutputStream = null;
FileOutputStream fileOutputStream;
if (targetFile.length() > 0) {
fileOutputStream = new FileOutputStream(entry.getPath(), true);
} else {
@ -85,9 +82,9 @@ public class DownloadThread extends Thread {
//设置自动重定向
connection.setInstanceFollowRedirects(true);
}
bis = new BufferedInputStream(connection.getInputStream());
bos = new BufferedOutputStream(fileOutputStream);
BufferedInputStream bis = new BufferedInputStream(connection.getInputStream());
BufferedOutputStream bos = new BufferedOutputStream(fileOutputStream);
long conentLength = connection.getContentLength();
String eTag = connection.getHeaderField("ETag");
if (!TextUtils.isEmpty(eTag) && eTag.startsWith("\"") && eTag.endsWith("\"")) {