Given a url, I want to transfer the file in that url to a specific to ftp. I have two options: 1) Using external library (like apache common-io) I can fetch the file from the url and then upload it to the ftp. 2) Open two sockets (to the url an to the ftp) and simply transfer the file from the url to the ftp.
I'm I right about this? What's the best way to do that?
I'm using spring.
Here are some links that I found about it:
How to download and save a file from Internet using Java?.
Here is the apache common-io library
Edit:
I'm dealing with 100-200M files.
Update: I choose to first download the file and then upload it. I choose to do this since I don't expect many problems downloading the file, but I expect problems uploading the file to the FTP server. So, I think the the error handling will better that way. The lack of this solution is the fact that I'm storing the temporary file in the disk. I'll update later if I'll encounter some problems.