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 Details

    • FTPDownloader

      public FTPDownloader()
      Empty default constructor
    • FTPDownloader

      public FTPDownloader(String host) throws Exception
      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

      public FTPDownloader(String host, boolean debug) throws Exception
      Set up an anonymous FTP connection.
      Parameters:
      host - the FTP host
      debug - if true, the FTP protocol commands are printed
      Throws:
      Exception - thrown if the connection could not be made
    • FTPDownloader

      public FTPDownloader(String host, String user, String pwd, boolean debug) throws Exception
      Set up an FTP connection.
      Parameters:
      host - the FTP host
      user - the FTP user name
      pwd - the FTP password
      debug - 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, IOException
      Download the given file from the FTP server.
      Parameters:
      remoteFilePath - the remote file path
      localFilePath - the local file path
      Throws:
      FileNotFoundException - if a FileNotFoundException occurs
      IOException - if an IOException occurs
    • disconnect

      public void disconnect() throws IOException
      Disconnect from the FTP server.
      Throws:
      IOException - if an IOException occurs