mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 14:28:46 +00:00
update downloadmanager...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
189e10bd00
commit
58fc3a4549
@ -101,6 +101,7 @@ public class DownloadManager {
|
|||||||
return run(sender, url, file);
|
return run(sender, url, file);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
sender.sendMessage("§4错误: §c无法识别的URL地址...");
|
sender.sendMessage("§4错误: §c无法识别的URL地址...");
|
||||||
|
sender.sendMessage("§4地址: §c" + urlstring);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,6 +127,11 @@ public class DownloadManager {
|
|||||||
sender.sendMessage("§6开始下载: §3" + getFileName(url));
|
sender.sendMessage("§6开始下载: §3" + getFileName(url));
|
||||||
sender.sendMessage("§6下载地址: §3" + url.toString());
|
sender.sendMessage("§6下载地址: §3" + url.toString());
|
||||||
int fileLength = url.openConnection().getContentLength();
|
int fileLength = url.openConnection().getContentLength();
|
||||||
|
if (fileLength < 0) {
|
||||||
|
sender.sendMessage("§6下载: §c文件 " + file.getName() + " 获取长度错误(可能是网络问题)!");
|
||||||
|
sender.sendMessage("§6文件: §c " + file.getName() + " 下载失败!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
sender.sendMessage("§6文件长度: §3" + fileLength);
|
sender.sendMessage("§6文件长度: §3" + fileLength);
|
||||||
in = new BufferedInputStream(url.openStream());
|
in = new BufferedInputStream(url.openStream());
|
||||||
if (!file.getParentFile().exists()) {
|
if (!file.getParentFile().exists()) {
|
||||||
@ -153,11 +159,11 @@ public class DownloadManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sender.sendMessage("§6文件: §a" + file.getName() + " 下载完成!");
|
sender.sendMessage("§6文件: §a " + file.getName() + " 下载完成!");
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
sender.sendMessage("§6异常: §c" + ex.getMessage());
|
sender.sendMessage("§6异常: §c" + ex.getMessage());
|
||||||
sender.sendMessage("§6文件: §c" + file.getName() + "下载失败!");
|
sender.sendMessage("§6文件: §c" + file.getName() + " 下载失败!");
|
||||||
return false;
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user