Package com.compomics.util.io.ftp
Class FTPDownloader
java.lang.Object
com.compomics.util.io.ftp.FTPDownloader
public class FTPDownloader extends Object
A simple FTP file downloader.
- Author:
- Harald Barsnes
-
Constructor Summary
Constructors Constructor Description FTPDownloader()
Empty default constructorFTPDownloader(String host)
Set up an anonymous FTP connection (without protocol commands printed).FTPDownloader(String host, boolean debug)
Set up an anonymous FTP connection.FTPDownloader(String host, String user, String pwd, boolean debug)
Set up an FTP connection. -
Method Summary
Modifier and Type Method Description void
disconnect()
Disconnect from the FTP server.void
downloadFile(String remoteFilePath, File localFilePath)
Download the given file from the FTP server.
-
Constructor Details
-
FTPDownloader
public FTPDownloader()Empty default constructor -
FTPDownloader
Set up an anonymous FTP connection (without protocol commands printed).- Parameters:
host
- the FTP host- Throws:
Exception
- thrown if the connection could not be made
-
FTPDownloader
Set up an anonymous FTP connection.- Parameters:
host
- the FTP hostdebug
- if true, the FTP protocol commands are printed- Throws:
Exception
- thrown if the connection could not be made
-
FTPDownloader
Set up an FTP connection.- Parameters:
host
- the FTP hostuser
- the FTP user namepwd
- the FTP passworddebug
- if true, the FTP protocol commands are printed- Throws:
Exception
- thrown if the connection could not be made
-
-
Method Details
-
downloadFile
public void downloadFile(String remoteFilePath, File localFilePath) throws FileNotFoundException, IOExceptionDownload the given file from the FTP server.- Parameters:
remoteFilePath
- the remote file pathlocalFilePath
- the local file path- Throws:
FileNotFoundException
- if a FileNotFoundException occursIOException
- if an IOException occurs
-
disconnect
Disconnect from the FTP server.- Throws:
IOException
- if an IOException occurs
-