Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PACIT
Manage
Activity
Members
Labels
Plan
Issues
6
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dad
PACIT
Commits
055b0b25
Commit
055b0b25
authored
3 years ago
by
ella
Browse files
Options
Downloads
Patches
Plain Diff
version fonctionnel du telechargement
parent
c6c9da6e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#6499
passed with stages
in 1 minute and 4 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/fr/cines/pacit/transfer/impl/TransferCamelImpl.java
+10
-6
10 additions, 6 deletions
.../java/fr/cines/pacit/transfer/impl/TransferCamelImpl.java
src/main/resources/config.properties
+1
-1
1 addition, 1 deletion
src/main/resources/config.properties
with
11 additions
and
7 deletions
src/main/java/fr/cines/pacit/transfer/impl/TransferCamelImpl.java
+
10
−
6
View file @
055b0b25
...
...
@@ -8,6 +8,7 @@ package fr.cines.pacit.transfer.impl;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.net.HttpURLConnection
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.nio.channels.Channels
;
...
...
@@ -25,14 +26,17 @@ public class TransferCamelImpl {
String
fileName
=
"vitam-data-test-master"
;
public
void
downloadFile
(
String
url
,
String
fileName
)
throws
IOException
public
void
downloadFile
(
String
url
,
String
localPath
)
throws
IOException
{
URL
ulr
=
new
URL
(
url
);
FileOutputStream
fileOutputStream
=
new
FileOutputStream
(
fileName
);
FileChannel
fileChannel
=
fileOutputStream
.
getChannel
();
ReadableByteChannel
readableByteChannel
=
Channels
.
newChannel
(
ulr
.
openStream
());
fileOutputStream
.
getChannel
().
transferFrom
(
readableByteChannel
,
0
,
Long
.
MAX_VALUE
);
HttpURLConnection
connection
=
(
HttpURLConnection
)
ulr
.
openConnection
();
connection
.
setRequestProperty
(
"accept"
,
"*/*"
);
ReadableByteChannel
readableFileChannel
=
Channels
.
newChannel
(
connection
.
getInputStream
());
FileOutputStream
fos
=
new
FileOutputStream
(
localPath
+
"//vitam-data-test.zip"
);
fos
.
getChannel
().
transferFrom
(
readableFileChannel
,
0
,
Long
.
MAX_VALUE
);
}
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/config.properties
+
1
−
1
View file @
055b0b25
url
=
https://dci-gitlab.cines.fr/dad/vitam-data-test/-/archive/master/vitam-data-test-master.zip
localPath
=
file:/C:/Users/ella/Desktop/testTransfer/
\ No newline at end of file
localPath
=
C:/Users/ella/Desktop/TestTranfer2/
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment