Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-fileview
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jenkins
slm-fileview
Commits
212526d9
Unverified
Commit
212526d9
authored
Jan 28, 2021
by
gitchenjh
Committed by
GitHub
Jan 28, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #209 from gitchenjh/master
修复:jodd.io.NetUtil.downloadFile下载大于16M文件报错问题
parents
3531af4a
ef5052e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
DownloadUtils.java
server/src/main/java/cn/keking/utils/DownloadUtils.java
+10
-3
No files found.
server/src/main/java/cn/keking/utils/DownloadUtils.java
View file @
212526d9
...
...
@@ -4,7 +4,6 @@ import cn.keking.config.ConfigConstants;
import
cn.keking.model.FileAttribute
;
import
cn.keking.model.ReturnResponse
;
import
io.mola.galimatias.GalimatiasParseException
;
import
jodd.io.NetUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -38,8 +37,16 @@ public class DownloadUtils {
try
{
URL
url
=
WebUtils
.
normalizedURL
(
urlStr
);
if
(
isHttpUrl
(
url
))
{
File
realFile
=
new
File
(
realPath
);
NetUtil
.
downloadFile
(
url
.
toString
(),
realFile
);
URLConnection
connection
=
url
.
openConnection
();
InputStream
is
=
connection
.
getInputStream
();
FileOutputStream
os
=
new
FileOutputStream
(
realPath
);
byte
[]
buffer
=
new
byte
[
4
*
1024
];
int
read
;
while
((
read
=
is
.
read
(
buffer
))
>
0
)
{
os
.
write
(
buffer
,
0
,
read
);
}
os
.
close
();
is
.
close
();
}
else
if
(
isFtpUrl
(
url
))
{
String
ftpUsername
=
WebUtils
.
getUrlParameterReg
(
fileAttribute
.
getUrl
(),
URL_PARAM_FTP_USERNAME
);
String
ftpPassword
=
WebUtils
.
getUrlParameterReg
(
fileAttribute
.
getUrl
(),
URL_PARAM_FTP_PASSWORD
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment