Sun Adapter for Batch/FTP

com.stc.eways.batchext
Interface FtpFileProvider

All Known Implementing Classes:
FtpFileProviderImpl, FtpFileProviderImplUser0

public interface FtpFileProvider

This interface represents the Provider node in the FTP ETD structure. You can implement this interface to provide your own implementations. This class provides the core FTP feature and function interfaces.

Version:
cvs revision: $Revision: 1.6 $ Last Modified: $Date: 2008/02/25 16:56:24 $
Author:
Harry Liu

Method Summary
 boolean appendFile(java.lang.String remoteFileName, java.io.InputStream local)
          Appends to a file onto the remote FTP server with the given file name, taking its input from the given InputStream.
 boolean appendFile(java.lang.String remoteFileName, java.lang.String localFileName)
          Appends to a file onto the remote FTP server with the given file name, taking its input from the given file name.
 boolean appendFile(java.lang.String remoteDirName, java.lang.String remoteBaseFileName, java.io.InputStream local)
          Appends to a file onto the remote FTP server with the given file name, taking its input from the given InputStream.
 boolean appendFile(java.lang.String remoteDirName, java.lang.String remoteBaseFileName, java.lang.String localFileName)
          Appends to a file onto the remote FTP server with the given directory and file name, taking its input from the given file name.
 java.io.OutputStream appendFileStream(java.lang.String remoteFileName)
          Returns an OutputStream through which data can be written.
 java.io.OutputStream appendFileStream(java.lang.String dirName, java.lang.String baseFileName)
          Returns an OutputStream through which data can be written.
 boolean archiveFile(java.lang.String dirNameFrom, java.lang.String baseFileNameFrom, java.lang.String dirNameTo, java.lang.String baseFileNameTo)
          Renames a remote file.
 boolean ascii()
          Sets the file type (to be transferred) to ASCII.
 boolean binary()
          Sets the file type (to be transferred) to binary.
 boolean cd(java.lang.String dirName)
          Changes the current working directory of the FTP session.
 boolean completePendingCommand()
          Finishes the pending command.
 void connect(java.lang.String host, int port)
          Opens a socket connected to a remote FTP host at the specified port and originating from the current host at a system-assigned port.
 void connect(java.lang.String host, int port, java.lang.String encoding)
          Opens a socket connected to a remote FTP host at the specified port and originating from the current host at a system-assigned port.
 boolean deleteFile(java.lang.String remoteFileName)
          Deletes a file on the remote FTP server.
 boolean deleteFile(java.lang.String dirName, java.lang.String baseFileName)
          Deletes a file on the remote FTP server.
 void disConnect()
          Closes the connection to the FTP server and restores the e*Way Connection parameters to the default values.
 boolean ebcdic()
          Sets the file type (to be transferred) to EBCDIC.
 int getDataConnectionMode()
          Returns the current data connection mode (one of the _DATA_CONNECTION_MODE constants), for example, PASSIVE or ACTIVE.
 java.lang.String getFirstFileName(java.lang.String dir, boolean isDirRegex, java.lang.String file, boolean isFileRegex)
          Gets the first matching remote file name based on the remote directory regular expression and remote file regular expression.
 FtpHeuristics getHeuristics()
          Accessor - Get the FtpHeuristics object.
 int getReplyCode()
          Returns the integer value of the reply code of the last FTP reply.
 java.lang.String getReplyString()
          Returns the entire text of the last FTP server response exactly as it was received.
 java.lang.String[] getReplyStrings()
          Returns the lines of text from the last FTP server response as an array of strings, one entry per line.
 int getSoLinger()
          Returns the current SO_LINGER timeout (in seconds) of the currently opened socket.
 int getSoTimeout()
          Returns the timeout, in milliseconds, of the currently opened socket.
 java.lang.String getSystemName()
          Retrieves the system type name from the remote FTP server and returns the string.
 boolean getTcpNoDelay()
          Allows you to determine whether Nagle's algorithm is enabled on the currently opened socket.
 boolean image()
          Sets the file type of the file to be transferred, to "Image."
 void initialize(FtpETD etd)
          Initializes the FTP ETD object.
 boolean isConnected()
          Checks on whether the client is currently connected to a server.
 boolean isNegativePermanent(int replyCode)
          Checks on whether the FTP operation is "Negative Permanent;" the return code can be any integer from 500 through 599.
 boolean isNegativeTransient(int replyCode)
          Checks on whether the FTP operation is "Negative Transient;" the return code can be any integer from 400 through 499.
 boolean isPositiveCompletion(int replyCode)
          Checks on whether the FTP operation is "Positive Completion;" the return code can be any integer from 200 through 299.
 boolean isPositiveIntermediate(int replyCode)
          Checks on whether the FTP operation is "Positive Intermediate;" the return code can be any integer from 300 through 399.
 boolean isPositivePreliminary(int replyCode)
          Checks on whether the FTP operation is "Positive Preliminary;" the return code can be any integer from 100 through 199.
 boolean isRemoteVerificationEnabled()
          Allows you to determine whether verification of the remote FTP host participating in data connections is enabled.
 boolean isTraceRawCommand()
          Check if the trace flag is on.
 java.lang.String[] listFileNames(com.oroinc.net.ftp.FTPFile[] files)
          Gets the names of all file entries that are related to real file data.
 java.lang.String[] listFileNames(java.lang.String dir, boolean isDirRegex, java.lang.String file, boolean isFileRegex)
          Lists the remote full file names based on the remote directory regular expression and remote file regular expression.
 com.oroinc.net.ftp.FTPFile[] listFiles()
          Using the default FileListParser , obtain a list of file information for the current working directory.
 com.oroinc.net.ftp.FTPFile[] listFiles(com.oroinc.net.ftp.FTPFile[] files, boolean listRealData)
          Gets all file entries that can be used to get real data, when the parameter listRealData is true.
 com.oroinc.net.ftp.FTPFile[] listFiles(com.oroinc.net.ftp.FTPFile[] files, int fileType)
          Filters files by type.
 com.oroinc.net.ftp.FTPFile[] listFiles(java.lang.String pathName)
          Using the default FileListParser, obtains a list of file information for the given working directory.
 com.oroinc.net.ftp.FTPFile[] listFiles(java.lang.String pathName, java.lang.String regExp)
          Using default FileListParser, obtains a list of file information for the given working directory and regular expression.
 java.lang.String listHelp()
          Retrieves the system help information from the remote FTP server and returns the full string.
 java.lang.String listHelp(java.lang.String command)
          Retrieves the help information for a given command from the remote FTP server and returns the full string.
 boolean login(java.lang.String user, java.lang.String password)
          Logs into the remote FTP server using the provided user name and password.
 boolean logout()
          Logs out of the remote FTP server by sending the QUIT command.
 boolean mkdir(java.lang.String dir)
          Creates a new directory if the directory does not exist.
 boolean mkdirs(java.lang.String dir)
          Creates a new directory if the directory does not exist.
 java.lang.String pwd()
          Returns the path name of the current working directory.
 boolean rename(java.lang.String remoteFileNameFrom, java.lang.String remoteFileNameTo)
          Renames a remote file.
 boolean rename(java.lang.String dirNameFrom, java.lang.String baseFileNameFrom, java.lang.String dirNameTo, java.lang.String baseFileNameTo)
          Renames a remote file.
 boolean retrieveFile(java.lang.String remoteFileName, java.io.OutputStream local)
          Retrieves a named file from the remote FTP server and writes it to the given OutputStream.
 boolean retrieveFile(java.lang.String remoteFileName, java.lang.String localFileName)
          Retrieves a named file from the remote FTP server and writes it to the given local file.
 boolean retrieveFile(java.lang.String remoteDirName, java.lang.String remoteBaseFileName, java.io.OutputStream local)
          Retrieves a named file from the remote FTP server and writes it to the given OutputStream.
 boolean retrieveFile(java.lang.String remoteDirName, java.lang.String remoteBaseFileName, java.lang.String localFileName)
          Retrieves a named file from the remote FTP server and writes it to the given local file.
 java.io.InputStream retrieveFileStream(java.lang.String remoteFileName)
          Returns an InputStream from which a named file from the remote FTP server can be read.
 java.io.InputStream retrieveFileStream(java.lang.String dirName, java.lang.String baseFileName)
          Returns an InputStream from which a named file from the remote FTP server can be read.
 boolean rmdir(java.lang.String dirName)
          Removes a directory on the remote FTP server, if it is empty.
 int sendCommand(java.lang.String command)
          Sends an FTP command without a parameter to the server.
 int sendCommand(java.lang.String command, java.lang.String parm)
          Sends an FTP command to the server.
 boolean sendSiteCommand(java.lang.String command)
          send a site command to FTP server
 void setDataSocketTimeout(int timeout)
          Sets the timeout, in milliseconds, to use when reading from the data connection.
 void setDirListingStyle(java.lang.String dirListingStyle)
          Initializes and update the FTP heuristics using the specified directory listing style.
 void setRemoteVerificationEnabled(boolean enable)
          Allows you to enable or disable verification that the remote FTP host taking part in a given data connection is the same as the host to which the control connection is attached.
 void setSocketFactory(com.oroinc.net.SocketFactory factory)
          Sets the SocketFactory used by the SocketClient to open socket connections.
 void setSoLinger(boolean on, int val)
          Sets the SO_LINGER timeout (in seconds) on the currently opened command socket.
 void setSoTimeout(int timeout)
          Sets the timeout, in milliseconds, of a currently open command connection.
 void setTcpNoDelay(boolean on)
          Allows you to enable or disable the Nagle's algorithm (TCP_NODELAY) on the currently opened command socket.
 void setTraceRawCommand(boolean newTraceRawCommand)
          Allows you to turn the trace flag on or off.
 void setUserDefinedHeuristicsInfo(java.lang.String userDirListingStyle, java.lang.String userHeuristicsCfgFile)
          initialize and update the FTP heuristics using the specified user defined heuristics information;
 boolean storeFile(java.lang.String remoteFileName, java.io.InputStream local)
          Stores a file on the server using the given name and takes input from the given InputStream.
 boolean storeFile(java.lang.String remoteFileName, java.lang.String localFileName)
          Stores a file on the remote FTP server using the given name and takes input from the given local file.
 boolean storeFile(java.lang.String remoteDirName, java.lang.String remoteBaseFileName, java.io.InputStream local)
          Stores a file on the server using the given name and takes input from the given InputStream.
 boolean storeFile(java.lang.String remoteDirName, java.lang.String remoteBaseFileName, java.lang.String localFileName)
          Stores a file on the remote FTP server using the given name and takes input from the given local file.
 java.io.OutputStream storeFileStream(java.lang.String remoteFileName)
          Returns an OutputStream through which data can be written to store a file on the server using the given name.
 java.io.OutputStream storeFileStream(java.lang.String dirName, java.lang.String baseFileName)
          Returns an OutputStream through which data can be written to store a file on the server using the given name.
 void useActive()
          Sets the current data connection mode to ACTIVE_LOCAL_DATA_CONNECTION_MODE.
 void usePassive()
          Sest the current data connection mode to PASSIVE_LOCAL_DATA_CONNECTION_MODE.
 

Method Detail

appendFile

boolean appendFile(java.lang.String remoteFileName,
                   java.lang.String localFileName)
                   throws java.io.IOException
Appends to a file onto the remote FTP server with the given file name, taking its input from the given file name. The FileInputSteam related to the localFileName is closed in this method.

Parameters:
remoteFileName - The remote file name.
localFileName - The local file name.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

appendFile

boolean appendFile(java.lang.String remoteDirName,
                   java.lang.String remoteBaseFileName,
                   java.lang.String localFileName)
                   throws java.io.IOException
Appends to a file onto the remote FTP server with the given directory and file name, taking its input from the given file name. The FileInputSteam related to the localFileName is closed in this method.

Parameters:
remoteDirName - The remote directory name.
remoteBaseFileName - The remote base file name.
localFileName - The local file name.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

appendFile

boolean appendFile(java.lang.String remoteFileName,
                   java.io.InputStream local)
                   throws java.io.IOException
Appends to a file onto the remote FTP server with the given file name, taking its input from the given InputStream. The InputSteam is NOT closed in this method.

Parameters:
remoteFileName - The remote file name.
local - The local input stream.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

appendFile

boolean appendFile(java.lang.String remoteDirName,
                   java.lang.String remoteBaseFileName,
                   java.io.InputStream local)
                   throws java.io.IOException
Appends to a file onto the remote FTP server with the given file name, taking its input from the given InputStream. The InputSteam is NOT closed in this method.

Parameters:
remoteFileName - The remote file name.
local - The local input stream.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

appendFileStream

java.io.OutputStream appendFileStream(java.lang.String remoteFileName)
                                      throws java.io.IOException
Returns an OutputStream through which data can be written. This data is used to append to a file with the given file name, on the remote FTP server. If the current file type is ASCII, the returned OutputStream converts line separators in the file to the NETASCII format (therefore, do not create a special OutputStream to do this operation). You must close the OutputStream when you finish writing to it. The OutputStream itself takes care of closing the parent data connection socket upon being closed. To finalize the file transfer, you must call the method completePendingCommand() and check its return value to verify its success.

Parameters:
remoteFileName - The remote file name.
Returns:
An OutputStream through which the remote file can be appended. If the data connection cannot be opened (for example, if the file does not exist), a null is returned (in which case you can check the reply code to determine the exact reason for the failure).
Throws:
java.io.IOException - If some error occurs.

appendFileStream

java.io.OutputStream appendFileStream(java.lang.String dirName,
                                      java.lang.String baseFileName)
                                      throws java.io.IOException
Returns an OutputStream through which data can be written. This data is used to append to a file with the given file name, on the remote FTP server. If the current file type is ASCII, the returned OutputStream converts line separators in the file to the NETASCII format (therefore, do not create a special OutputStream to do this operation). You must close the OutputStream when you finish writing to it. The OutputStream itself takes care of closing the parent data connection socket upon being closed. To finalize the file transfer, you must call the method completePendingCommand() and check its return value to verify its success.

Parameters:
remoteFileName - The remote file name.
baseFileName - The remote base file name.
Returns:
An OutputStream through which the remote file can be appended. If the data connection cannot be opened (for example, if the file does not exist), a null is returned (in which case you can check the reply code to determine the exact reason for the failure).
Throws:
java.io.IOException - If some error occurs.

archiveFile

boolean archiveFile(java.lang.String dirNameFrom,
                    java.lang.String baseFileNameFrom,
                    java.lang.String dirNameTo,
                    java.lang.String baseFileNameTo)
                    throws java.io.IOException
Renames a remote file. This method creates the target path if it does not already exist (the difference between this method and the rename() method).

Parameters:
dirNameFrom - The old remote directory name.
baseFileNameFrom - The old remote base file name.
dirNameTo - The new remote directory name.
baseFileNameTo - The new remote base file name.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

ascii

boolean ascii()
              throws java.io.IOException
Sets the file type (to be transferred) to ASCII.

Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

binary

boolean binary()
               throws java.io.IOException
Sets the file type (to be transferred) to binary.

Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

cd

boolean cd(java.lang.String dirName)
           throws java.io.IOException
Changes the current working directory of the FTP session.

Parameters:
dirName - The new directory name.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

completePendingCommand

boolean completePendingCommand()
                               throws java.io.IOException
Finishes the pending command. There are a few FTPClient methods that do not complete the entire sequence of FTP commands to complete a transaction. These commands require some action by the programmer after the reception of a positive intermediate command. After the programmer's code completes its actions, if necessary, the current command must call this method to receive the completion reply from the remote FTP server and verify the success of the entire transaction.

Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

connect

void connect(java.lang.String host,
             int port)
             throws java.net.SocketException,
                    java.io.IOException
Opens a socket connected to a remote FTP host at the specified port and originating from the current host at a system-assigned port.

Parameters:
host - The FTP host name.
port - The FTP server port.
Throws:
java.net.SocketException - If some socket error occurs.
java.io.IOException - If some IO error occurs.

connect

void connect(java.lang.String host,
             int port,
             java.lang.String encoding)
             throws java.net.SocketException,
                    java.io.IOException
Opens a socket connected to a remote FTP host at the specified port and originating from the current host at a system-assigned port.

Parameters:
host - The FTP host name.
port - The FTP server port.
encoding - The encoding for the server.
Throws:
java.net.SocketException - If some socket error occurs.
java.io.IOException - If some IO error occurs.

deleteFile

boolean deleteFile(java.lang.String remoteFileName)
                   throws java.io.IOException
Deletes a file on the remote FTP server.

Parameters:
remoteFileName - The remote file name to be deleted.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

deleteFile

boolean deleteFile(java.lang.String dirName,
                   java.lang.String baseFileName)
                   throws java.io.IOException
Deletes a file on the remote FTP server.

Parameters:
dirName - The remote directory name of the file.
baseFileName - The base name of the file.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

disConnect

void disConnect()
                throws java.io.IOException
Closes the connection to the FTP server and restores the e*Way Connection parameters to the default values.

Throws:
java.io.IOException - If some error occurs.

ebcdic

boolean ebcdic()
               throws java.io.IOException
Sets the file type (to be transferred) to EBCDIC.

Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

getDataConnectionMode

int getDataConnectionMode()
Returns the current data connection mode (one of the _DATA_CONNECTION_MODE constants), for example, PASSIVE or ACTIVE.

Returns:
The data connection mode.

getHeuristics

FtpHeuristics getHeuristics()
Accessor - Get the FtpHeuristics object.

Returns:
The FtpHeuristics object.

getReplyCode

int getReplyCode()
Returns the integer value of the reply code of the last FTP reply.

Returns:
The reply code.

getReplyString

java.lang.String getReplyString()
Returns the entire text of the last FTP server response exactly as it was received.

Returns:
The reply string.

getReplyStrings

java.lang.String[] getReplyStrings()
Returns the lines of text from the last FTP server response as an array of strings, one entry per line.

Returns:
The reply string lines.

getSoLinger

int getSoLinger()
                throws java.net.SocketException
Returns the current SO_LINGER timeout (in seconds) of the currently opened socket. A -1 return means that the option is disabled. The setting only affects socket closing.

Returns:
The current SO_LINGER timeout. If SO_LINGER is disabled, the return is -1.
Throws:
java.net.SocketException - If the operation fails.

getSoTimeout

int getSoTimeout()
                 throws java.net.SocketException
Returns the timeout, in milliseconds, of the currently opened socket.

Returns:
The timeout, in milliseconds, of the currently opened socket.
Throws:
java.net.SocketException - If the operation fails.

getSystemName

java.lang.String getSystemName()
                               throws java.io.IOException
Retrieves the system type name from the remote FTP server and returns the string.

Returns:
The system name.
Throws:
java.io.IOException - If some error occurs.

getTcpNoDelay

boolean getTcpNoDelay()
                      throws java.net.SocketException
Allows you to determine whether Nagle's algorithm is enabled on the currently opened socket.

Returns:
true if Nagle's algorithm is enabled on the currently opened socket, but false if otherwise.
Throws:
java.net.SocketException - If the operation fails.

image

boolean image()
              throws java.io.IOException
Sets the file type of the file to be transferred, to "Image."

Returns:
True if successfully completed, false if not.
Throws:
java.io.IOException - If some error occurs.

initialize

void initialize(FtpETD etd)
                throws FtpFileException
Initializes the FTP ETD object.

Parameters:
etd - The FTP ETD instance.
Throws:
FtpFileException - If some error occurs.

isConnected

boolean isConnected()
Checks on whether the client is currently connected to a server.

Returns:
true if it is connected, but false if not.

isNegativePermanent

boolean isNegativePermanent(int replyCode)
Checks on whether the FTP operation is "Negative Permanent;" the return code can be any integer from 500 through 599.

Parameters:
replyCode - The reply code of the FTP operation.
Returns:
Whether the FTP operation is "Negative Permanent."

isNegativeTransient

boolean isNegativeTransient(int replyCode)
Checks on whether the FTP operation is "Negative Transient;" the return code can be any integer from 400 through 499.

Parameters:
replyCode - The reply code of the FTP operation.
Returns:
Whether the FTP operation is "Negative Transient."

isPositiveCompletion

boolean isPositiveCompletion(int replyCode)
Checks on whether the FTP operation is "Positive Completion;" the return code can be any integer from 200 through 299.

Parameters:
replyCode - The reply code of the FTP operation.
Returns:
Whether the FTP operation is "Positive Completion."

isPositiveIntermediate

boolean isPositiveIntermediate(int replyCode)
Checks on whether the FTP operation is "Positive Intermediate;" the return code can be any integer from 300 through 399.

Parameters:
replyCode - The reply code of the FTP operation.
Returns:
Whether the FTP operation is "Positive Intermediate."

isPositivePreliminary

boolean isPositivePreliminary(int replyCode)
Checks on whether the FTP operation is "Positive Preliminary;" the return code can be any integer from 100 through 199.

Parameters:
replyCode - The reply code of the FTP operation.
Returns:
Whether the FTP operation is "Positive Preliminary."

isRemoteVerificationEnabled

boolean isRemoteVerificationEnabled()
Allows you to determine whether verification of the remote FTP host participating in data connections is enabled. The default is for verification to be enabled.

Returns:
true if verification is enabled, but false if not.

isTraceRawCommand

boolean isTraceRawCommand()
Check if the trace flag is on.

Returns:
True if trace flag is on, false if not.

listFileNames

java.lang.String[] listFileNames(com.oroinc.net.ftp.FTPFile[] files)
                                 throws java.io.IOException
Gets the names of all file entries that are related to real file data. This method filters out directory entries and pure symbolic link entries.

Parameters:
files - An array of FTPFile objects.
Returns:
An array of String objects.
Throws:
java.io.IOException - If some error occurs.

listFiles

com.oroinc.net.ftp.FTPFile[] listFiles()
                                       throws java.io.IOException
Using the default FileListParser , obtain a list of file information for the current working directory.

Returns:
An array of FTPFile objects.
Throws:
java.io.IOException - If some error occurs.

listFiles

com.oroinc.net.ftp.FTPFile[] listFiles(com.oroinc.net.ftp.FTPFile[] files,
                                       int fileType)
                                       throws java.io.IOException
Filters files by type. The file types can be any of the following: FTPFile.FILE_TYPE, FTPFile.DIRECTORY_TYPE, FTPFile.SYMBOLIC_LINK_TYPE or FTPFile.UNKNOWN_TYPE.

Parameters:
files - An array of FTPFile objects.
fileType - The file type.
Returns:
An array of FTPFile objects.
Throws:
java.io.IOException - If some error occurs.

listFiles

com.oroinc.net.ftp.FTPFile[] listFiles(com.oroinc.net.ftp.FTPFile[] files,
                                       boolean listRealData)
                                       throws java.io.IOException
Gets all file entries that can be used to get real data, when the parameter listRealData is true. The file entries contain all files with FILE_TYPE and/or files with SYMBOLIC_LINK_TYPE, if they are linked to real data that is available (in FtpHeuristics) the parameter is true. However, if the list only contains files with FILE_TYPE , if they are linked to real data that is available, the parameter is false. This method filters out directory entries and pure symbolic link entries.

Parameters:
files - An array of FTPFile objects.
listRealData - Indicates whether the files listed contain real data.
Returns:
An array of FTPFile objects.
Throws:
java.io.IOException - If some error occurs.

listFiles

com.oroinc.net.ftp.FTPFile[] listFiles(java.lang.String pathName)
                                       throws java.io.IOException
Using the default FileListParser, obtains a list of file information for the given working directory.

Parameters:
pathName - The directory name.
Returns:
An array of FTPFile objects.
Throws:
java.io.IOException - If some error occurs.

listFiles

com.oroinc.net.ftp.FTPFile[] listFiles(java.lang.String pathName,
                                       java.lang.String regExp)
                                       throws java.io.IOException
Using default FileListParser, obtains a list of file information for the given working directory and regular expression.

Parameters:
pathName - The directory name.
regExp - The file name regular expression.
Returns:
An array of FTPFile objects.
Throws:
java.io.IOException - If some error occurs.

listHelp

java.lang.String listHelp()
                          throws java.io.IOException
Retrieves the system help information from the remote FTP server and returns the full string.

Returns:
The system help information.
Throws:
java.io.IOException - If some error occurs.

listHelp

java.lang.String listHelp(java.lang.String command)
                          throws java.io.IOException
Retrieves the help information for a given command from the remote FTP server and returns the full string.

Parameters:
command - The command given.
Returns:
The system help information.
Throws:
java.io.IOException - If some error occurs.

login

boolean login(java.lang.String user,
              java.lang.String password)
              throws java.io.IOException
Logs into the remote FTP server using the provided user name and password.

Parameters:
user - The user name.
password - The password.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

logout

boolean logout()
               throws java.io.IOException
Logs out of the remote FTP server by sending the QUIT command.

Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

mkdir

boolean mkdir(java.lang.String dir)
              throws java.io.IOException
Creates a new directory if the directory does not exist. For directory dir1/dir2, if the parent directory dir1 does not exist, the method fails. There is another method, mkdirs(), that creates all necessary parent directories.

Parameters:
dir - The directory name to be created.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

mkdirs

boolean mkdirs(java.lang.String dir)
               throws java.io.IOException
Creates a new directory if the directory does not exist. This method also creates all necessary parent directories.

Parameters:
dir - The directory name to be created.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

pwd

java.lang.String pwd()
                     throws java.io.IOException
Returns the path name of the current working directory.

Returns:
The current working directory path name.
Throws:
java.io.IOException - If some error occurs.

rename

boolean rename(java.lang.String remoteFileNameFrom,
               java.lang.String remoteFileNameTo)
               throws java.io.IOException
Renames a remote file.

Parameters:
remoteFileNameFrom - The old remote file name.
remoteFileNameTo - The new remote file name.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

rename

boolean rename(java.lang.String dirNameFrom,
               java.lang.String baseFileNameFrom,
               java.lang.String dirNameTo,
               java.lang.String baseFileNameTo)
               throws java.io.IOException
Renames a remote file.

Parameters:
dirNameFrom - The old remote directory name.
baseFileNameFrom - The old remote base file name.
dirNameTo - The new remote directory name.
baseFileNameTo - The new remote base file name.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

retrieveFile

boolean retrieveFile(java.lang.String remoteFileName,
                     java.lang.String localFileName)
                     throws java.io.IOException
Retrieves a named file from the remote FTP server and writes it to the given local file. The FileOutputSteam related to the localFileName is closed in this method.

Parameters:
remoteFileName - The remote file name.
localFileName - The local file name.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

retrieveFile

boolean retrieveFile(java.lang.String remoteDirName,
                     java.lang.String remoteBaseFileName,
                     java.lang.String localFileName)
                     throws java.io.IOException
Retrieves a named file from the remote FTP server and writes it to the given local file. The FileOutputSteam related to the localFileName is closed in this method.

Parameters:
remoteDirName - The remote directory name.
remoteBaseFileName - The remote base file name.
localFileName - The local file name.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

retrieveFile

boolean retrieveFile(java.lang.String remoteFileName,
                     java.io.OutputStream local)
                     throws java.io.IOException
Retrieves a named file from the remote FTP server and writes it to the given OutputStream. The OutputSteam is NOT closed in this method.

Parameters:
remoteFileName - The remote file name.
local - The local output stream.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

retrieveFile

boolean retrieveFile(java.lang.String remoteDirName,
                     java.lang.String remoteBaseFileName,
                     java.io.OutputStream local)
                     throws java.io.IOException
Retrieves a named file from the remote FTP server and writes it to the given OutputStream. The OutputSteam is NOT closed in this method.

Parameters:
remoteDirName - The remote directory name.
remoteBaseFileName - The remote base file name.
local - The local output stream.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

retrieveFileStream

java.io.InputStream retrieveFileStream(java.lang.String remoteFileName)
                                       throws java.io.IOException
Returns an InputStream from which a named file from the remote FTP server can be read. If the current file type is ASCII, the returned InputStream converts the line separators in the file to the local representation. You must close the InputStream when you finish reading from it. The InputStream itself takes care of closing the parent data connection socket upon being closed. To finalize the file transfer you must call the method completePendingCommand() and check its return value to verify your success.

Parameters:
remoteFileName - The remote file name.
Returns:
An InputStream from which the remote file can be read. If the data connection cannot be opened (for example, if the file does not exist), a null is returned, in which case you can check the reply code to determine the exact reason for failure.
Throws:
java.io.IOException - If some error occurs.

retrieveFileStream

java.io.InputStream retrieveFileStream(java.lang.String dirName,
                                       java.lang.String baseFileName)
                                       throws java.io.IOException
Returns an InputStream from which a named file from the remote FTP server can be read. If the current file type is ASCII, the returned InputStream converts the line separators in the file to the local representation. You must close the InputStream when you finish reading from it. The InputStream itself takes care of closing the parent data connection socket upon being closed. To finalize the file transfer you must call the method completePendingCommand() and check its return value to verify your success.

Parameters:
dirName - The remote directory name.
baseFileName - The remote base file name.
Returns:
An InputStream from which the remote file can be read. If the data connection cannot be opened (for example, if the file does not exist), a null is returned, in which case you can check the reply code to determine the exact reason for failure.
Throws:
java.io.IOException - If some error occurs.

rmdir

boolean rmdir(java.lang.String dirName)
              throws java.io.IOException
Removes a directory on the remote FTP server, if it is empty.

Parameters:
dirName - The name of the remote directory to remove.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

sendCommand

int sendCommand(java.lang.String command)
                throws java.io.IOException
Sends an FTP command without a parameter to the server. The method then waits for a reply and returns the numerical response code.

Parameters:
command - The FTP command to be executed.
Returns:
The reply code from the FTP command.
Throws:
java.io.IOException - If some error occurs.

sendCommand

int sendCommand(java.lang.String command,
                java.lang.String parm)
                throws java.io.IOException
Sends an FTP command to the server. The method then waits for a reply and returns the numerical response code.

Parameters:
command - The FTP command to be executed.
parm - The parameter of the FTP command.
Returns:
The reply code from FTP command.
Throws:
java.io.IOException - If some error occurs.

sendSiteCommand

boolean sendSiteCommand(java.lang.String command)
                        throws java.io.IOException
send a site command to FTP server

Parameters:
command - - site command
Returns:
- true, success, false, failure;
Throws:
java.io.IOException

setDataSocketTimeout

void setDataSocketTimeout(int timeout)
Sets the timeout, in milliseconds, to use when reading from the data connection. This timeout is set immediately after the data connection is opened. NOTE: This connection is not the command connection.

Parameters:
timeout - The timeout, in milliseconds, that is used when opening a data connection socket.

setRemoteVerificationEnabled

void setRemoteVerificationEnabled(boolean enable)
Allows you to enable or disable verification that the remote FTP host taking part in a given data connection is the same as the host to which the control connection is attached. The default is for verification to be enabled. You can set this value at any time, whether the FTP client is currently connected or not.

Parameters:
enable - true enables verification, and false disables it.

setSocketFactory

void setSocketFactory(com.oroinc.net.SocketFactory factory)
Sets the SocketFactory used by the SocketClient to open socket connections. If the factory value is a null, a default factory value is used. Only use this method to reset the factory after you have previously altered it.

Parameters:
factory - The new SocketFactory the SocketClient must use.

setSoLinger

void setSoLinger(boolean on,
                 int val)
                 throws java.net.SocketException
Sets the SO_LINGER timeout (in seconds) on the currently opened command socket. The maximum timeout value is platform-specific. The setting only affects the closing of the socket.

Parameters:
on - true if the timeout is to be enabled, and false if not.
val - The timeout in seconds (in hundredths of a second?)
Throws:
java.net.SocketException - If the operation fails.

setSoTimeout

void setSoTimeout(int timeout)
                  throws java.net.SocketException
Sets the timeout, in milliseconds, of a currently open command connection. Only call this method after a command connection has been opened by the connect() method. A timeout of zero is interpreted as an infinite timeout. To set the timeout before using connect() and avoiding the possible blocking of the connect() method, instead use the method setDefaultTimeout(). The timeout set by setDefaultTimeout() can be overwritten by the timeout set by setSoTimeout().

Parameters:
timeout - The timeout, in milliseconds, to use for the currently open command connection socket.
Throws:
java.net.SocketException - If the operation fails.

setTcpNoDelay

void setTcpNoDelay(boolean on)
                   throws java.net.SocketException
Allows you to enable or disable the Nagle's algorithm (TCP_NODELAY) on the currently opened command socket.

Parameters:
on - true to enable Nagle's algorithm, and false to disable.
Throws:
java.net.SocketException - If the operation fails.

setTraceRawCommand

void setTraceRawCommand(boolean newTraceRawCommand)
Allows you to turn the trace flag on or off.

Parameters:
newTraceRawCommand - true or false.

storeFile

boolean storeFile(java.lang.String remoteFileName,
                  java.lang.String localFileName)
                  throws java.io.IOException
Stores a file on the remote FTP server using the given name and takes input from the given local file. The FileInputSteam related to the localFileName is closed in this method.

Parameters:
remoteFileName - The remote file name.
localFileName - The local file name.
Returns:
true if the operation is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

storeFile

boolean storeFile(java.lang.String remoteDirName,
                  java.lang.String remoteBaseFileName,
                  java.lang.String localFileName)
                  throws java.io.IOException
Stores a file on the remote FTP server using the given name and takes input from the given local file. The FileInputSteam related to the localFileName is closed in this method.

Parameters:
remoteDirName - The remote directory name.
remoteBaseFileName - The remote file name.
localFileName - The local file name.
Returns:
True if successfully completed, false if not.
Throws:
java.io.IOException - If some error occurs.

storeFile

boolean storeFile(java.lang.String remoteFileName,
                  java.io.InputStream local)
                  throws java.io.IOException
Stores a file on the server using the given name and takes input from the given InputStream. The InputSteam is NOT closed in this method.

Parameters:
remoteFileName - The remote file name.
local - The local input stream.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

storeFile

boolean storeFile(java.lang.String remoteDirName,
                  java.lang.String remoteBaseFileName,
                  java.io.InputStream local)
                  throws java.io.IOException
Stores a file on the server using the given name and takes input from the given InputStream. The InputSteam is NOT closed in this method.

Parameters:
remoteDirName - The remote directory name.
remoteBaseFileName - The remote file name.
local - The local input stream.
Returns:
true if the action is successfully completed, but false if not.
Throws:
java.io.IOException - If some error occurs.

storeFileStream

java.io.OutputStream storeFileStream(java.lang.String remoteFileName)
                                     throws java.io.IOException
Returns an OutputStream through which data can be written to store a file on the server using the given name. If the current file type is ASCII, the returned OutputStream converts line separators in the file to the NETASCII format , that is, you do not have to create a special OutputStream to do this operation. You must close the OutputStream when you finish writing to it. The OutputStream itself takes care of closing the parent data connection socket upon being closed. To finalize the file transfer, you must call the method completePendingCommand() and check its return value to verify your success.

Parameters:
remoteFileName - The remote file name.
Returns:
An OutputStream through which the remote file can be written. If the data connection cannot be opened (for example, the file does not exist), a null is returned. In such cases, you can check the reply code to determine the exact reason for failure.
Throws:
java.io.IOException - If some error occurs.

storeFileStream

java.io.OutputStream storeFileStream(java.lang.String dirName,
                                     java.lang.String baseFileName)
                                     throws java.io.IOException
Returns an OutputStream through which data can be written to store a file on the server using the given name. If the current file type is ASCII, the returned OutputStream converts line separators in the file to the NETASCII format , that is, you do not have to create a special OutputStream to do this operation. You must close the OutputStream when you finish writing to it. The OutputStream itself takes care of closing the parent data connection socket upon being closed. To finalize the file transfer, you must call the method completePendingCommand() and check its return value to verify your success.

Parameters:
dirName - The remote directory name.
baseFileName - The remote base file name.
Returns:
An OutputStream through which the remote file can be written. If the data connection cannot be opened (for example, the file does not exist), a null is returned. In such cases, you can check the reply code to determine the exact reason for failure.
Throws:
java.io.IOException - If some error occurs.

useActive

void useActive()
Sets the current data connection mode to ACTIVE_LOCAL_DATA_CONNECTION_MODE.


usePassive

void usePassive()
Sest the current data connection mode to PASSIVE_LOCAL_DATA_CONNECTION_MODE.


getFirstFileName

java.lang.String getFirstFileName(java.lang.String dir,
                                  boolean isDirRegex,
                                  java.lang.String file,
                                  boolean isFileRegex)
                                  throws java.io.IOException
Gets the first matching remote file name based on the remote directory regular expression and remote file regular expression.

Parameters:
dir - The directory name.
isDirRegex - Tells whether the directory name is a regular expression.
file - The file name.
isFileRegex - Tells whether the file name is a regular expression.
Returns:
The full file name.
Throws:
java.io.IOException - If some error occurs.

listFileNames

java.lang.String[] listFileNames(java.lang.String dir,
                                 boolean isDirRegex,
                                 java.lang.String file,
                                 boolean isFileRegex)
                                 throws java.io.IOException
Lists the remote full file names based on the remote directory regular expression and remote file regular expression.

Parameters:
dir - The directory name.
isDirRegex - Tells whether the directory name is a regular expression.
file - The file name.
isFileRegex - Tells whether the file name is a regular expression.
Returns:
The full file names.
Throws:
java.io.IOException - If some error occurs.

setUserDefinedHeuristicsInfo

void setUserDefinedHeuristicsInfo(java.lang.String userDirListingStyle,
                                  java.lang.String userHeuristicsCfgFile)
                                  throws java.lang.Exception
initialize and update the FTP heuristics using the specified user defined heuristics information;

Parameters:
userDirListingStyle - - the name of the user defined directory listing style must be the name of the an entry in the user defined heuristics configuration file - as specified by userHeuristicsCfgFile
userHeuristicsCfgFile - - a path pointing to the user defined heuristics configuration file;
Throws:
java.lang.Exception

setDirListingStyle

void setDirListingStyle(java.lang.String dirListingStyle)
                        throws java.lang.Exception
Initializes and update the FTP heuristics using the specified directory listing style.

Parameters:
dirListingStyle - The directory listing style.
Throws:
java.lang.Exception - If some error occurs.

Sun Adapter for Batch/FTP