新作关键词

This commit is contained in:
2022-04-17 01:20:40 +08:00
parent f6c9748f48
commit 2558545ffe
2 changed files with 17 additions and 9 deletions

View File

@@ -161,7 +161,7 @@ public class HttpTools {
}
private static String donwloadPath = "tmp" + File.separator;
public static String downloadPath = "tmp" + File.separator;
public synchronized static void download(final String url, final String saveName, final DownloadInterface downloadInterface) {
download(url,saveName,false,downloadInterface);
@@ -172,7 +172,7 @@ public class HttpTools {
public void run() {
File jar = null;
try {
File savePath = new File(donwloadPath);
File savePath = new File(downloadPath);
Proxy proxy=null;
if (!savePath.exists()) {
savePath.mkdirs();
@@ -200,7 +200,7 @@ public class HttpTools {
// Log.i(TAG,"获取到网络请求:"+connection.getResponseCode());
InputStream inputStream = connection.getInputStream();
jar = new File(donwloadPath + saveName + "_tmp.tmp");
jar = new File(downloadPath + saveName + "_tmp.tmp");
jar.createNewFile();
Log.i("DOWNLOAD", "临时保存文件:" + jar.getAbsolutePath());
OutputStream outputStream = new FileOutputStream(jar);
@@ -217,7 +217,7 @@ public class HttpTools {
}
outputStream.close();
inputStream.close();
File oldJar = new File(donwloadPath + saveName);
File oldJar = new File(downloadPath + saveName);
if (oldJar.exists()) {
oldJar.delete();
}
@@ -247,7 +247,7 @@ public class HttpTools {
}
File jar = null;
try {
File savePath = new File(donwloadPath);
File savePath = new File(downloadPath);
if (!savePath.exists()) {
savePath.mkdirs();
}
@@ -258,7 +258,7 @@ public class HttpTools {
connection.addRequestProperty("Content-type","image/jpeg");
InputStream inputStream = connection.getInputStream();
jar = new File(donwloadPath + saveName + "_tmp.tmp");
jar = new File(downloadPath + saveName + "_tmp.tmp");
jar.createNewFile();
Log.i("DOWNLOAD", "临时保存文件:" + jar.getAbsolutePath());
OutputStream outputStream = new FileOutputStream(jar);
@@ -271,7 +271,7 @@ public class HttpTools {
}
outputStream.close();
inputStream.close();
File oldJar = new File(donwloadPath + saveName);
File oldJar = new File(downloadPath + saveName);
if (oldJar.exists()) {
oldJar.delete();
}