Commit cb219521 authored by 陈精华's avatar 陈精华 Committed by Gitee

!19 兼容本地绝对路径文件获取(win、linux)

Merge pull request !19 from zhangxiaoxiao/master
parents 3498df04 fb09a8c0
...@@ -56,7 +56,7 @@ public class DownloadUtils { ...@@ -56,7 +56,7 @@ public class DownloadUtils {
} }
try { try {
URL url = new URL(urlStr); URL url = new URL(urlStr);
if (url.getProtocol() != null && url.getProtocol().toLowerCase().startsWith("http")) { if (url.getProtocol() != null && (url.getProtocol().toLowerCase().startsWith("file")||url.getProtocol().toLowerCase().startsWith("http"))) {
byte[] bytes = getBytesFromUrl(urlStr); byte[] bytes = getBytesFromUrl(urlStr);
OutputStream os = new FileOutputStream(new File(realPath)); OutputStream os = new FileOutputStream(new File(realPath));
saveBytesToOutStream(bytes, os); saveBytesToOutStream(bytes, os);
......
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