public class FTPDownloader extends Object
Constructor and Description |
---|
FTPDownloader(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.
|
Modifier and Type | Method and Description |
---|---|
void |
disconnect()
Disconnect from the FTP server.
|
void |
downloadFile(String remoteFilePath,
File localFilePath)
Download the given file from the FTP server.
|
public FTPDownloader(String host) throws Exception
host
- the FTP hostException
- thrown if the connection could not be madepublic FTPDownloader(String host, boolean debug) throws Exception
host
- the FTP hostdebug
- if true, the FTP protocol commands are printedException
- thrown if the connection could not be madepublic FTPDownloader(String host, String user, String pwd, boolean debug) throws Exception
host
- the FTP hostuser
- the FTP user namepwd
- the FTP passworddebug
- if true, the FTP protocol commands are printedException
- thrown if the connection could not be madepublic void downloadFile(String remoteFilePath, File localFilePath) throws FileNotFoundException, IOException
remoteFilePath
- the remote file pathlocalFilePath
- the local file pathFileNotFoundException
- if a FileNotFoundException occursIOException
- if an IOException occurspublic void disconnect() throws IOException
IOException
- if an IOException occursCopyright © 2016. All rights reserved.