Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
abd6fffd
Commit
abd6fffd
authored
Jun 19, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEV] write http inputstrem to tempfile output stream
parent
e64f7125
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
FileUploadAdapter.java
.../pwc/taxtech/atms/vat/service/impl/FileUploadAdapter.java
+19
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/FileUploadAdapter.java
View file @
abd6fffd
...
...
@@ -12,6 +12,10 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
import
pwc.taxtech.atms.constant.enums.EnumModule
;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URI
;
import
java.util.Calendar
;
import
java.util.Date
;
...
...
@@ -69,6 +73,21 @@ public class FileUploadAdapter {
if
(
completeFile
.
exists
())
completeFile
.
delete
();
}
try
(
FileOutputStream
fos
=
new
FileOutputStream
(
new
File
(
tempPath
));
InputStream
inputStream
=
request
.
getFile
(
FILE_NAME
).
getInputStream
();)
{
byte
[]
buffer
=
new
byte
[
4096
];
int
bytesRead
;
while
((
bytesRead
=
inputStream
.
read
(
buffer
,
0
,
buffer
.
length
))
!=
0
)
{
fos
.
write
(
buffer
,
0
,
bytesRead
);
}
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
if
(
paramBean
.
isLastChunk
)
{
LOGGER
.
debug
(
"Last chunk arrived"
);
File
completeFile
=
new
File
(
completePath
);
...
...
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