Package com.compomics.util.io.ftp
Class FTPClient
java.lang.Object
com.compomics.util.io.ftp.FTPClient
This class implements a 'directory listener' to listen for new files and
ftp them to a remote FTP server.
This class uses the implementation found on the web for an FTP client.
This class uses the implementation found on the web for an FTP client.
- Author:
- Lennart Martens
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsendBinaryFile(String aFilename) This method sends a binary file to the default FTP location on the server.voidThis method sends a group of files to the default FTP location on the server.voidThis method sends a group of files to the default FTP location on the server.voidsendTextFile(String aFilename) This method sends a text file to the default FTP location on the server.voidThis method can be used to test the connection with the FTP server.
-
Constructor Details
-
FTPClient
public FTPClient()Empty default constructor -
FTPClient
Constructor that takes the three parameters necessary for the FTP connection. Note that in FTP, passwords are typically sent in plain text!!!- Parameters:
aHost- String with the hostname of the FTP server to connect to.aUser- String with the username to connect with.aPassword- String with the password for the specified user.
-
-
Method Details
-
sendTextFile
This method sends a text file to the default FTP location on the server.- Parameters:
aFilename- String with the filename to send.- Throws:
IOException- when retrieving the file fails, or sending the file failed.
-
sendBinaryFile
This method sends a binary file to the default FTP location on the server.- Parameters:
aFilename- String with the filename to send.- Throws:
IOException- when retrieving the file fails, or sending the file failed.
-
sendFiles
This method sends a group of files to the default FTP location on the server. It also allows the specification of binary or text mode.- Parameters:
aFilenames- String[] with the filenames of the files to send.aBinaryMode- boolean[] to indicate whether the files are to be send in binary transfer mode ('true') or text mode ('false'). Note that this setting applies to all files in the group.- Throws:
IOException- when retrieving the file fails, or sending the file failed.
-
sendFiles
This method sends a group of files to the default FTP location on the server. It also allows the specification of binary or text mode.- Parameters:
aFilenames- String[] with the filenames of the files to send.aBinaryMode- boolean to indicate whether the files are to be send in binary transfer mode ('true') or text mode ('false'). Note that this setting applies to all files in the group.- Throws:
IOException- when retrieving the file fails, or sending the file failed.
-
testFTPConnection
This method can be used to test the connection with the FTP server.- Throws:
IOException- whenever a connection could not be established.
-