Reputation: 1583
is there any possible way to write a file to a FTP directory using some sort of OutputStream without having to write a local file first?
I've found some 3rd party libraries which achieve this, but I was wondering if there is some java "standard" class that makes it possible, I mean, some class that is packaged into the standar Java API.
Thank you!!
Upvotes: 1
Views: 2681
Reputation: 5344
The best practice is building abstract layer to not depend from FTP solution.
As for me the best tool for Java FTP is http://www.sauronsoftware.it/projects/ftp4j/
Upvotes: 2
Reputation: 2025
URL url = new URL("ftp://user:[email protected]/file.txt;type=i");
URLConnection urlc = url.openConnection();
InputStream is = urlc.getInputStream(); // To download
OutputStream os = urlc.getOutputStream(); // To upload
Upvotes: 5