com.compomics.util.io
Class FTPClient

java.lang.Object
  extended by com.compomics.util.io.FTPClient

public class FTPClient
extends java.lang.Object

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.

Author:
Lennart Martens

Constructor Summary
FTPClient(java.lang.String aHost, java.lang.String aUser, java.lang.String aPassword)
          Constructor that takes the three parameters necessary for the FTP connection.
 
Method Summary
 void sendBinaryFile(java.lang.String aFilename)
          This method sends a binary file to the default FTP location on the server.
 void sendFiles(java.lang.String[] aFilenames, boolean aBinaryMode)
          This method sends a group of files to the default FTP location on the server.
 void sendFiles(java.lang.String[] aFilenames, boolean[] aBinaryMode)
          This method sends a group of files to the default FTP location on the server.
 void sendTextFile(java.lang.String aFilename)
          This method sends a text file to the default FTP location on the server.
 void testFTPConnection()
          This method can be used to test the connection with the FTP server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FTPClient

public FTPClient(java.lang.String aHost,
                 java.lang.String aUser,
                 java.lang.String aPassword)
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 Detail

sendTextFile

public void sendTextFile(java.lang.String aFilename)
                  throws java.io.IOException
This method sends a text file to the default FTP location on the server.

Parameters:
aFilename - String with the filename to send.
Throws:
java.io.IOException - when retrieving the file fails, or sending the file failed.

sendBinaryFile

public void sendBinaryFile(java.lang.String aFilename)
                    throws java.io.IOException
This method sends a binary file to the default FTP location on the server.

Parameters:
aFilename - String with the filename to send.
Throws:
java.io.IOException - when retrieving the file fails, or sending the file failed.

sendFiles

public void sendFiles(java.lang.String[] aFilenames,
                      boolean[] aBinaryMode)
               throws java.io.IOException
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:
java.io.IOException - when retrieving the file fails, or sending the file failed.

sendFiles

public void sendFiles(java.lang.String[] aFilenames,
                      boolean aBinaryMode)
               throws java.io.IOException
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:
java.io.IOException - when retrieving the file fails, or sending the file failed.

testFTPConnection

public void testFTPConnection()
                       throws java.io.IOException
This method can be used to test the connection with the FTP server.

Throws:
java.io.IOException - whenever a connection could not be established.


Copyright © 2011. All Rights Reserved.