Secure iNet Factory

com.jscape.inet.ftp
Class FtpImplementation

java.lang.Object
  extended by com.jscape.inet.ftp.FtpImplementation

public abstract class FtpImplementation
extends java.lang.Object

Base class for all FTP client implementations.


Constructor Summary
FtpImplementation()
           
 
Method Summary
 void addListener(FtpListener listener)
          Removes specified Ftp event listener.
abstract  void changePassword(java.lang.String oldPassword, java.lang.String newPassword)
          Changes the password.
 void clearProxySettings()
          Clears SOCKS related settings.
abstract  void connect()
          Connects to FTP server and performs login.
abstract  void connect(boolean login)
          Connects to FTP server and optionally performs login
abstract  void deleteDir(java.lang.String remoteName, boolean recurse)
          Deletes directory from FTP server.
abstract  void deleteFile(java.lang.String remoteName)
          Deletes remote file from FTP server.
abstract  void dirUp()
          Sets current directory on FTP server to parent directory.
abstract  void disconnect()
          Quits FTP session and disconnects from FTP server.
abstract  void download(java.io.OutputStream out, java.lang.String remoteName, long off)
          Downloads file from FTP server and writes contents to provided OutputStream.
 java.lang.String getAccount()
          Gets account for FTP server.
 boolean getAutoDetectIpv6()
          Get auto detect Ipv6 mode.
 int getBlockTransferSize()
          Gets blocksize for use in transferring files.
abstract  boolean getCompression()
          Gets whether the data is compressed during the transfering.
abstract  boolean getConnectBeforeCommand()
          Gets the connectBefore indicator
abstract  int getDataPort()
           
abstract  int getDataPortEnd()
          Gets the data port end range for incoming data connections
abstract  int getDataPortStart()
          Gets the data port start range for incoming data connections
 boolean getDebug()
          Gets debugging state.
 java.io.PrintStream getDebugStream()
          Gets PrintStream used in reporting debugPrint statements.
abstract  java.lang.String getDir()
          Gets current working directory of FTP server.
abstract  java.util.Vector getDirListing(java.lang.String filter)
          Gets directory listing from FTP server.
 java.lang.String getDirListingAsString(java.lang.String filter)
          Gets file listing of files matching filter criteria.
 java.lang.String getDiskEncoding()
          Gets character encoding used when reading data from disk for ASCII file transfer.
 java.lang.String getEncoding()
          Deprecated. use the getWireEncoding method
abstract  boolean getErrorOnSizeCommand()
          Gets the error on size command indicator.
abstract  java.util.Vector getFeatures()
          Returns supported server features.
abstract  long getFileSize(java.lang.String remoteName)
          Gets filesize of remote file from FTP server as represented in ASCII.
abstract  java.util.Date getFileTimeStamp(java.lang.String remoteName)
          Gets date/timestamp of remote file from FTP server This feature is not supported by RFC-959 so may not work on all FTP servers.
 java.lang.String getHost()
          Gets hostname of FTP server.
abstract  java.io.InputStream getInputStream(java.lang.String remoteName, long off)
          Gets the InputStream from the data connection
 boolean getKeepAlive(boolean keepAlive)
          Get keep alive.
 int getLinger()
          Get Linger.
 java.util.Vector getListeners()
          Get listeners.
abstract  java.util.Vector getMachineDirListing(java.lang.String dirname)
          Gets file listing of specified directory using MLSD command.
abstract  java.util.Vector getMachineDirListing(java.lang.String dirname, java.lang.String regex)
          Gets file listing of specified directory using MLSD command.
abstract  FtpFile getMachineFileListing(java.lang.String filename)
          Gets the file description for the specified filename.
abstract  java.util.Vector getNameListing(java.lang.String filter)
           
abstract  java.lang.String getNATAddress()
          Get the NAT Address
abstract  java.io.OutputStream getOutputStream(java.lang.String fileName, boolean append, long off)
          Gets the OutputStream from the data connection
 java.lang.String getPassword()
          Returns current FTP user password.
 int getPort()
          Gets port of FTP server.
 java.lang.String getPortAddress()
          Gets the external address to use when using active connections using the PORT command.
 boolean getPreserveDownloadTimestamp()
          Get preserve download timestamp.
 boolean getPreserveUploadTimestamp()
          Get upload modification time.
 java.lang.String getProxyHostname()
          Get proxy hostname.
 java.lang.String getProxyPassword()
          Get proxy password.
 int getProxyPort()
          Get proxy port.
 java.lang.String getProxyType()
          Get proxy type.
 java.lang.String getProxyUsername()
          Get proxy username.
abstract  int getResponseCode()
          Gets response code from last FTP command.
abstract  java.lang.String getSystemType()
          Gets the system type of remote FTP server.
 int getTimeout()
          Gets the timeout for opening connection to FTP server.
 java.util.TimeZone getTimeZone()
          Get the associated timezone.
abstract  int getTransferMode()
          Returns current transfer mode.
abstract  boolean getUseEPRT()
          Gets use EPRT value.
abstract  boolean getUseEPSV()
          Gets use EPSV value.
 java.lang.String getUser()
          Gets username of FTP user.
 java.lang.String getWireEncoding()
          Gets character encoding used when issuing commands and reading files from FTP server in ASCII mode.
 void interrupt()
          Interrupts the current data transfer and sets interrupted flag to true.
 boolean interrupted()
          Checks if transfer process was interrupted.
abstract  boolean isConnected()
          Checks if client is connected to FTP server.
abstract  boolean isFeatureSupported(java.lang.String command)
          Looks for the command argument into the server features list to validate if it is supported
abstract  boolean isPassive()
          Tests the passive mode for data connections.
abstract  java.lang.String issueCommand(java.lang.String command)
          Issues command to FTP server.
abstract  java.lang.String issueCommandCheck(java.lang.String command)
          Issues command to FTP server.
abstract  void login()
          Logs into FTP server after establishing a connection.
abstract  void makeDir(java.lang.String newName)
          Makes directory on FTP server.
abstract  java.lang.String noop()
          Sends a NOOP (No Operation) command to FTP server.
abstract  void readResponse()
          Reads server response
 void removeListener(FtpListener listener)
           
abstract  void renameFile(java.lang.String remoteName, java.lang.String newName)
          Renames remote file on FTP server.
 void reset()
          Resets the interrupted flag to false.
 void setAccount(java.lang.String account)
          Sets optional account for FTP server.
 void setAuto(boolean autoMode)
          Sets transfer mode automatically based on file extension.
 void setAutoDetectIpv6(boolean autoDetect)
          Set auto detect Ipv6 mode.
 void setBlockTransferSize(int size)
          Sets block size for use in transferring files.
abstract  void setCompression(boolean compression)
          Sets whether the data will be compressed during the transfer.
abstract  void setConnectBeforeCommand(boolean connect)
          Sets the connectBefore property value
abstract  void setDataPort(int dataPort)
           
abstract  void setDataPortEnd(int dataPort)
          Sets the end data port range for incomings connections
abstract  void setDataPortStart(int dataPort)
          Sets the start data port range for incomings connections
 void setDebug(boolean debug)
          Sets debugging state.
 void setDebugStream(java.io.PrintStream debugStream)
          Sets PrintStream used in reporting debugPrint statements.
abstract  void setDir(java.lang.String remoteName)
          Sets current directory on FTP server.
 void setDiskEncoding(java.lang.String encoding)
          Sets character set used when reading data from disk for ASCII file transfer.
 void setEncoding(java.lang.String encoding)
          Deprecated. use the setWireEncoding method
abstract  void setErrorOnSizeCommand(boolean error)
          Sets the indicator value which will be used by methods that invokes getFileSize.
abstract  void setFileCreationTime(java.lang.String remoteName, java.util.Date dateFile)
          Sets file creation time with a new value.
abstract  void setFileModificationTime(java.lang.String remoteName, java.util.Date dateFile)
          Sets the file modification time with a new value.
abstract  void setFileTimeStamp(java.lang.String remoteName, java.util.Date dateFile)
          Sets date/timestamp of remote file from FTP server This feature is not supported by RFC-959 so may not work on all FTP servers.
 void setFtp(Ftp ftp)
          Sets reference to FTP instance.
 void setHost(java.lang.String host)
          Sets hostname of FTP server.
 void setKeepAlive(boolean keepAlive)
          Set socket keep alive.
 void setLinger(int linger)
          Set Linger.
 void setListeners(java.util.Vector listeners)
          Set listeners.
abstract  void setNATAddress(java.lang.String ipAddress)
          Sets a NAT address which will be used after PASV command.
abstract  void setPassive(boolean passive)
          Sets the passive mode for data connections.
 void setPassword(java.lang.String pwd)
          Sets password of FTP user.
 void setPort(int port)
          Sets port of FTP server.
 void setPortAddress(java.lang.String string)
          Sets the external address to use when using active connections using the PORT command.
 void setPreserveDownloadTimestamp(boolean value)
          Set the preserve download timestamp value.
 void setPreserveUploadTimestamp(boolean value)
          Set upload modification time, replaces the last modified timestamp with that of the local file after upload is complete.
 void setProxyAuthentication(java.lang.String proxyUsername, java.lang.String proxyPassword)
          Sets the proxy authentication username and password to use with proxy server.
 void setProxyHost(java.lang.String proxyHostname, int proxyPort)
          Sets the proxy hostname and port for this FTP connection.
 void setProxyType(java.lang.String proxyType)
          Sets the proxy type will be used for this FTP connection.
abstract  void setReceiveBufferSize(int receiveBufferSize)
          Sets the receive buffer size option of the ftp connection.
abstract  void setSendBufferSize(int sendBufferSize)
          Sets the send buffer size option of the ftp connection.
 void setTargetFile(java.lang.String file)
          Sets target file name.
 void setTargetPath(java.lang.String path)
          Sets target path.
 void setTimeout(int timeout)
          Sets the timeout for opening connection to FTP server.
 void setTimezone(java.util.TimeZone timeZone)
          Set the timezone.
abstract  void setTransferMode(int mode)
          Sets transfer mode.
abstract  void setUseEPRT(boolean useEPRT)
          Sets use EPSV indicator.
abstract  void setUseEPSV(boolean useEPSV)
          Sets use EPSV indicator.
 void setUser(java.lang.String user)
          Sets username of FTP user.
 void setWireEncoding(java.lang.String encoding)
          Sets character set used when issuing commands and transferring files in ASCII mode.
abstract  java.lang.String upload(java.io.InputStream in, java.lang.String remoteName, boolean append, long off, long total, boolean unique)
          Uploads data to FTP server.
abstract  java.lang.String uploadUnique(java.io.InputStream in, java.lang.String fileName)
          Uploads the data as file to be created in the current directory under a name unique to that directory
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FtpImplementation

public FtpImplementation()
Method Detail

setFtp

public void setFtp(Ftp ftp)
Sets reference to FTP instance.

Parameters:
ftp - reference to FTP instance.

setTimezone

public void setTimezone(java.util.TimeZone timeZone)
Set the timezone. This is used for file timestamps.

Parameters:
timeZone -

getTimeZone

public java.util.TimeZone getTimeZone()
Get the associated timezone. This is used for file timestamps. Default is GMT

Returns:
timezone

setPreserveDownloadTimestamp

public void setPreserveDownloadTimestamp(boolean value)
Set the preserve download timestamp value.

Parameters:
boolean - value

getPreserveDownloadTimestamp

public boolean getPreserveDownloadTimestamp()
Get preserve download timestamp.

Returns:
boolean value

getPreserveUploadTimestamp

public boolean getPreserveUploadTimestamp()
Get upload modification time.

Returns:
- boolean value

setPreserveUploadTimestamp

public void setPreserveUploadTimestamp(boolean value)
Set upload modification time, replaces the last modified timestamp with that of the local file after upload is complete.

Parameters:
value - - boolean value

setAutoDetectIpv6

public void setAutoDetectIpv6(boolean autoDetect)
Set auto detect Ipv6 mode.

Parameters:
autoDetect -

getAutoDetectIpv6

public boolean getAutoDetectIpv6()
Get auto detect Ipv6 mode.

Returns:

getHost

public java.lang.String getHost()
Gets hostname of FTP server.

Returns:
hostname

getAccount

public java.lang.String getAccount()
Gets account for FTP server. This should not be confused with username.

Returns:
the account
See Also:
setUser(String)

setAuto

public void setAuto(boolean autoMode)
Sets transfer mode automatically based on file extension.

Parameters:
autoMode -

setHost

public void setHost(java.lang.String host)
Sets hostname of FTP server.

Parameters:
host - the hostname or IP address of FTP server

setAccount

public void setAccount(java.lang.String account)
Sets optional account for FTP server. This should not be confused with username.

Parameters:
account -
See Also:
setUser(String)

getPort

public int getPort()
Gets port of FTP server.

Returns:
port

setPort

public void setPort(int port)
Sets port of FTP server.

Parameters:
port - the port of FTP server

getUser

public java.lang.String getUser()
Gets username of FTP user.

Returns:
username

setUser

public void setUser(java.lang.String user)
Sets username of FTP user.

Parameters:
user - the username of FTP user

setUseEPSV

public abstract void setUseEPSV(boolean useEPSV)
Sets use EPSV indicator. When it is true then will be sent EPSV.

Parameters:
useEPSV - The use EPSV value

getUseEPSV

public abstract boolean getUseEPSV()
Gets use EPSV value.

Returns:
true the passive mode will be sent EPSV command

setUseEPRT

public abstract void setUseEPRT(boolean useEPRT)
Sets use EPSV indicator. When it is true then will be sent EPSV.

Parameters:
useEPSV - The use EPSV value

getUseEPRT

public abstract boolean getUseEPRT()
Gets use EPRT value.

Returns:
true the passive mode will be sent EPRT command

getPassword

public java.lang.String getPassword()
Returns current FTP user password.

Returns:
current FTP password.

setPassword

public void setPassword(java.lang.String pwd)
Sets password of FTP user.

Parameters:
pwd - the password of FTP user

getTimeout

public int getTimeout()
Gets the timeout for opening connection to FTP server.

Returns:
timeout in milliseconds

setTimeout

public void setTimeout(int timeout)
Sets the timeout for opening connection to FTP server.

Parameters:
timeout - the timeout in milliseconds

setLinger

public void setLinger(int linger)
Set Linger.

Parameters:
linger -

getLinger

public int getLinger()
Get Linger.

Returns:
linger

setKeepAlive

public void setKeepAlive(boolean keepAlive)
Set socket keep alive.

Parameters:
keepAlive -

getKeepAlive

public boolean getKeepAlive(boolean keepAlive)
Get keep alive.

Parameters:
keepAlive -
Returns:
keep alive

getEncoding

public java.lang.String getEncoding()
Deprecated. use the getWireEncoding method

Gets character encoding used when issuing commands and transferring files.

Returns:
the character encoding to be used

setEncoding

public void setEncoding(java.lang.String encoding)
Deprecated. use the setWireEncoding method

Sets character set used when issuing commands and transferring files.

Parameters:
encoding - the character encoding to be used

setErrorOnSizeCommand

public abstract void setErrorOnSizeCommand(boolean error)
Sets the indicator value which will be used by methods that invokes getFileSize.

Parameters:
error - Error indicator value

getErrorOnSizeCommand

public abstract boolean getErrorOnSizeCommand()
Gets the error on size command indicator.

Returns:
true then method which invokes getFileSize will throw an exception when it caused an error, false the error will be ignored.

interrupted

public boolean interrupted()
Checks if transfer process was interrupted.

Returns:
true if transfer process was interrupted.

interrupt

public void interrupt()
Interrupts the current data transfer and sets interrupted flag to true.


reset

public void reset()
Resets the interrupted flag to false.


connect

public abstract void connect()
                      throws FtpException
Connects to FTP server and performs login.

Throws:
FtpException - if an I/O or FTP error occurs.

setDataPort

public abstract void setDataPort(int dataPort)

getDataPort

public abstract int getDataPort()

setConnectBeforeCommand

public abstract void setConnectBeforeCommand(boolean connect)
Sets the connectBefore property value

Parameters:
connect - It indicates if the connection will be established before send the command

getConnectBeforeCommand

public abstract boolean getConnectBeforeCommand()
Gets the connectBefore indicator

Returns:
true the connection will be establiched before send the command

getDataPortStart

public abstract int getDataPortStart()
Gets the data port start range for incoming data connections

Returns:
Start data port range for incoming data connections

getDataPortEnd

public abstract int getDataPortEnd()
Gets the data port end range for incoming data connections

Returns:
End data port range for incoming data connections

setDataPortStart

public abstract void setDataPortStart(int dataPort)
Sets the start data port range for incomings connections

Parameters:
dataPort - Start data Port range for incomings connections

setDataPortEnd

public abstract void setDataPortEnd(int dataPort)
Sets the end data port range for incomings connections

Parameters:
dataPort - End data Port range for incomings connections

connect

public abstract void connect(boolean login)
                      throws FtpException
Connects to FTP server and optionally performs login

Parameters:
login - true to login false otherwise
Throws:
FtpException - if an I/O or FTP error occurs

login

public abstract void login()
                    throws FtpException
Logs into FTP server after establishing a connection. This method should only be used if login is not performed automatically during connect.

Throws:
FtpException - if an I/O or FTP error occurs

changePassword

public abstract void changePassword(java.lang.String oldPassword,
                                    java.lang.String newPassword)
                             throws FtpException
Changes the password.

Parameters:
oldPassword - The old password.
newPassword - The new password.
Throws:
FtpException - FtpException if underlayed I/O or FTP error occurs.

disconnect

public abstract void disconnect()
Quits FTP session and disconnects from FTP server.


isConnected

public abstract boolean isConnected()
Checks if client is connected to FTP server.

Returns:
true if connected false otherwise

issueCommand

public abstract java.lang.String issueCommand(java.lang.String command)
                                       throws FtpException
Issues command to FTP server.

Parameters:
command - the command to issue
Returns:
response code
Throws:
FtpException - if an I/O or FTP error occurs

issueCommandCheck

public abstract java.lang.String issueCommandCheck(java.lang.String command)
                                            throws FtpException
Issues command to FTP server.

Parameters:
command - the command to issue
Returns:
response code
Throws:
FtpException - if an I/O or FTP error occurs

isFeatureSupported

public abstract boolean isFeatureSupported(java.lang.String command)
Looks for the command argument into the server features list to validate if it is supported

Parameters:
command - The feature will be searched
Returns:
true if the command is found into the server feature list; false otherwise

upload

public abstract java.lang.String upload(java.io.InputStream in,
                                        java.lang.String remoteName,
                                        boolean append,
                                        long off,
                                        long total,
                                        boolean unique)
                                 throws FtpException
Uploads data to FTP server.

Parameters:
in - data input stream.
remoteName - the filename to store file as on FTP server
append - true to append to remote file on FTP server, false otherwise
off - file offset.
total - total data lenght
unique - To use upload unique file
Returns:
remoteFileName response the response after the openConnection for STOU file name
Throws:
FtpException - if an I/O or FTP error occurs.

download

public abstract void download(java.io.OutputStream out,
                              java.lang.String remoteName,
                              long off)
                       throws FtpException
Downloads file from FTP server and writes contents to provided OutputStream.

Parameters:
out - data output stream.
remoteName - the filename to store file as on FTP server.
off - file offset
Throws:
FtpException - if an I/O or FTP error occurs.

getInputStream

public abstract java.io.InputStream getInputStream(java.lang.String remoteName,
                                                   long off)
                                            throws FtpException
Gets the InputStream from the data connection

Parameters:
remoteName - Remote file name
off - file offset
Returns:
Returns a InputStream from the data connection instance
Throws:
FtpException - if FTP error occurs.

getOutputStream

public abstract java.io.OutputStream getOutputStream(java.lang.String fileName,
                                                     boolean append,
                                                     long off)
                                              throws FtpException
Gets the OutputStream from the data connection

Parameters:
fileName - The name of the file
append - true to append to remote file on FTP server, false otherwise
off - file offset
Returns:
Returns a OutputStream from the data connection instance
Throws:
FtpException - if FTP error occurs.

uploadUnique

public abstract java.lang.String uploadUnique(java.io.InputStream in,
                                              java.lang.String fileName)
                                       throws FtpException
Uploads the data as file to be created in the current directory under a name unique to that directory

Parameters:
in - data input stream.
fileName - The file Name
Returns:
returns the file name in the ftp server
Throws:
FtpException

getFileSize

public abstract long getFileSize(java.lang.String remoteName)
                          throws FtpException
Gets filesize of remote file from FTP server as represented in ASCII. This feature is not supported by RFC-959 so may not work on all FTP servers. For larger files it may take some time to return as server will often convert file to ASCII before returning a filesize.

Parameters:
remoteName - the remote file
Returns:
filesize in bytes
Throws:
FtpException - if an I/O or FTP error occurs.

getFileTimeStamp

public abstract java.util.Date getFileTimeStamp(java.lang.String remoteName)
                                         throws FtpException
Gets date/timestamp of remote file from FTP server This feature is not supported by RFC-959 so may not work on all FTP servers.

Parameters:
remoteName - the remote file
Returns:
date the date/timestamp of remote file
Throws:
FtpException - if an I/O or FTP error occurs.

setFileTimeStamp

public abstract void setFileTimeStamp(java.lang.String remoteName,
                                      java.util.Date dateFile)
                               throws FtpException
Sets date/timestamp of remote file from FTP server This feature is not supported by RFC-959 so may not work on all FTP servers.

Parameters:
remoteName - the remote file
dateFile - the date/timestamp of remote file
Throws:
FtpException - if an I/O or FTP error occurs.

setFileCreationTime

public abstract void setFileCreationTime(java.lang.String remoteName,
                                         java.util.Date dateFile)
                                  throws FtpException
Sets file creation time with a new value. This command is not specified in RFC 959 and it is not support by many Ftp servers.

Parameters:
remoteName - File will be modified its creation time.
date - The new creation time
Throws:
FtpException - If an error occurs.

setFileModificationTime

public abstract void setFileModificationTime(java.lang.String remoteName,
                                             java.util.Date dateFile)
                                      throws FtpException
Sets the file modification time with a new value. This command is not specified in RFC 959 and it is not support by many Ftp servers.

Parameters:
remoteName - File will be modified its modification time.
date - The new modification time
Throws:
FtpException - If an error occurs

deleteFile

public abstract void deleteFile(java.lang.String remoteName)
                         throws FtpException
Deletes remote file from FTP server.

Parameters:
remoteName - name of file to delete
Throws:
FtpException - if an I/O or FTP error occurs.

renameFile

public abstract void renameFile(java.lang.String remoteName,
                                java.lang.String newName)
                         throws FtpException
Renames remote file on FTP server.

Parameters:
remoteName - name of file to rename
newName - new name of file
Throws:
FtpException - if an I/O or FTP error occurs.

getDirListing

public abstract java.util.Vector getDirListing(java.lang.String filter)
                                        throws FtpException
Gets directory listing from FTP server.

Parameters:
filter - the filename filter
Returns:
a Vector of String objects
Throws:
FtpException - if an I/O or FTP error occurs.

getNameListing

public abstract java.util.Vector getNameListing(java.lang.String filter)
                                         throws FtpException
Throws:
FtpException

getDir

public abstract java.lang.String getDir()
                                 throws FtpException
Gets current working directory of FTP server.

Returns:
current directory
Throws:
FtpException - if an I/O or FTP error occurs.

setDir

public abstract void setDir(java.lang.String remoteName)
                     throws FtpException
Sets current directory on FTP server.

Parameters:
remoteName - the remote directory
Throws:
FtpException - if an I/O or FTP error occurs.

dirUp

public abstract void dirUp()
                    throws FtpException
Sets current directory on FTP server to parent directory.

Throws:
FtpException - if an I/O or FTP error occurs.

makeDir

public abstract void makeDir(java.lang.String newName)
                      throws FtpException
Makes directory on FTP server.

Parameters:
newName - name of directory to make
Throws:
FtpException - if an I/O or FTP error occurs.

deleteDir

public abstract void deleteDir(java.lang.String remoteName,
                               boolean recurse)
                        throws FtpException
Deletes directory from FTP server.

Parameters:
remoteName - the directory to remove
recurse - true if it should delete files and subdirectories within directory
Throws:
FtpException - if an I/O or FTP error occurs.

getDirListingAsString

public java.lang.String getDirListingAsString(java.lang.String filter)
                                       throws FtpException
Gets file listing of files matching filter criteria.

Parameters:
filter - a filename filter
Returns:
a directory listing
Throws:
FtpException - if an I/O or FTP error occurs.

getMachineFileListing

public abstract FtpFile getMachineFileListing(java.lang.String filename)
                                       throws FtpException
Gets the file description for the specified filename.

Parameters:
filename - target filename. May be empty for current diectory
Returns:
file description
Throws:
FtpException - if an error occurs

getMachineDirListing

public abstract java.util.Vector getMachineDirListing(java.lang.String dirname)
                                               throws FtpException
Gets file listing of specified directory using MLSD command.

Parameters:
dirname - directory name
Returns:
a directory listing
Throws:
FtpException - if an error occurs

getMachineDirListing

public abstract java.util.Vector getMachineDirListing(java.lang.String dirname,
                                                      java.lang.String regex)
                                               throws FtpException
Gets file listing of specified directory using MLSD command.

Parameters:
dirname -
regex -
Returns:
Throws:
FtpException

getFeatures

public abstract java.util.Vector getFeatures()
                                      throws FtpException
Returns supported server features.

Returns:
an enumeration of features strings
Throws:
FtpException - if an error occurs

getSystemType

public abstract java.lang.String getSystemType()
                                        throws FtpException
Gets the system type of remote FTP server.

Returns:
system type
Throws:
FtpException - if an I/O or FTP error occurs.

noop

public abstract java.lang.String noop()
                               throws FtpException
Sends a NOOP (No Operation) command to FTP server.

Returns:
the response to the command
Throws:
FtpException - if an I/O or FTP error occurs

getTransferMode

public abstract int getTransferMode()
Returns current transfer mode.

Returns:
current transfer mode.

setTransferMode

public abstract void setTransferMode(int mode)
                              throws FtpException
Sets transfer mode.

Parameters:
mode - desired transfer mode.
Throws:
FtpException - if underlayed I/O or FTP error occurs.

isPassive

public abstract boolean isPassive()
Tests the passive mode for data connections.

Returns:
true if in passive mode.

setPassive

public abstract void setPassive(boolean passive)
Sets the passive mode for data connections.

Parameters:
passive - if true, the transfers will be passive.

setNATAddress

public abstract void setNATAddress(java.lang.String ipAddress)
                            throws FtpException
Sets a NAT address which will be used after PASV command.

Parameters:
ipAddress - The NAT IP address.
Throws:
FtpException - If an error occurs.

getNATAddress

public abstract java.lang.String getNATAddress()
Get the NAT Address

Returns:
address

setCompression

public abstract void setCompression(boolean compression)
Sets whether the data will be compressed during the transfer.

Parameters:
compression - Compression indicator.

getCompression

public abstract boolean getCompression()
Gets whether the data is compressed during the transfering. The data will be compressed if the Ftp server support this feature (MODE Z command)

Returns:
true data will be compressed, false otherwise.

getResponseCode

public abstract int getResponseCode()
Gets response code from last FTP command.

Returns:
response code

getBlockTransferSize

public int getBlockTransferSize()
Gets blocksize for use in transferring files. Default blocksize is 4096 bytes

Returns:
blocksize in bytes

setBlockTransferSize

public void setBlockTransferSize(int size)
Sets block size for use in transferring files. Default blocksize is 4096 bytes

Parameters:
size - the blocksize in bytes

getDebug

public boolean getDebug()
Gets debugging state.

Returns:
true if debugging is on

setDebug

public void setDebug(boolean debug)
Sets debugging state. All debugPrint statements are reported to debugPrint stream. Default debugPrint stream is System.out

Parameters:
debug - true to turn debugging on

getDebugStream

public java.io.PrintStream getDebugStream()
Gets PrintStream used in reporting debugPrint statements. Default PrintStream is System.out

Returns:
the PrintStream used in reporting debugPrint statements

setDebugStream

public void setDebugStream(java.io.PrintStream debugStream)
Sets PrintStream used in reporting debugPrint statements. Default PrintStream is System.out

Parameters:
debugStream - the PrintStream to send debugPrint statements to

addListener

public void addListener(FtpListener listener)
Removes specified Ftp event listener.

Parameters:
listener - the listener to remove

removeListener

public void removeListener(FtpListener listener)
Parameters:
listener -

getListeners

public java.util.Vector getListeners()
Get listeners.

Returns:
vector

setListeners

public void setListeners(java.util.Vector listeners)
Set listeners.

Parameters:
vector -

setTargetFile

public void setTargetFile(java.lang.String file)
Sets target file name. Used for creating FTP events.

Parameters:
file - target file name.

setTargetPath

public void setTargetPath(java.lang.String path)
Sets target path. Used for creating FTP events.

Parameters:
path - target path.

getDiskEncoding

public java.lang.String getDiskEncoding()
Gets character encoding used when reading data from disk for ASCII file transfer.

Returns:
the character encoding to be used

setDiskEncoding

public void setDiskEncoding(java.lang.String encoding)
Sets character set used when reading data from disk for ASCII file transfer.

Parameters:
encoding - the character encoding to be used

getWireEncoding

public java.lang.String getWireEncoding()
Gets character encoding used when issuing commands and reading files from FTP server in ASCII mode.

Returns:
the character encoding to be used

setWireEncoding

public void setWireEncoding(java.lang.String encoding)
Sets character set used when issuing commands and transferring files in ASCII mode.

Parameters:
encoding - the character encoding to be used

getPortAddress

public java.lang.String getPortAddress()
Gets the external address to use when using active connections using the PORT command.

Returns:
the external ip address

setPortAddress

public void setPortAddress(java.lang.String string)
Sets the external address to use when using active connections using the PORT command.

Parameters:
string - an ip address

setProxyAuthentication

public void setProxyAuthentication(java.lang.String proxyUsername,
                                   java.lang.String proxyPassword)
Sets the proxy authentication username and password to use with proxy server. To clear these settings invoke the #clearProxySettings method.

Parameters:
proxyUsername - the proxy username
proxyPassword - the proxy password
See Also:
clearProxySettings()

getProxyUsername

public java.lang.String getProxyUsername()
Get proxy username.

Returns:
username

getProxyPassword

public java.lang.String getProxyPassword()
Get proxy password.

Returns:
password

getProxyHostname

public java.lang.String getProxyHostname()
Get proxy hostname.

Returns:
hostname

getProxyPort

public int getProxyPort()
Get proxy port.

Returns:
port

getProxyType

public java.lang.String getProxyType()
Get proxy type.

Returns:
proxy type

setProxyHost

public void setProxyHost(java.lang.String proxyHostname,
                         int proxyPort)
Sets the proxy hostname and port for this FTP connection. To clear these settings invoke the #clearProxySettings method.

Parameters:
proxyHostname - the hostname or ip address of the proxy server
proxyPort - the port of the proxy server to connect to
See Also:
clearProxySettings()

setProxyType

public void setProxyType(java.lang.String proxyType)
Sets the proxy type will be used for this FTP connection.

Parameters:
proxyType - The proxy type. Values allowed: HTTP, SOCKS5

clearProxySettings

public void clearProxySettings()
Clears SOCKS related settings.


readResponse

public abstract void readResponse()
                           throws FtpException
Reads server response

Throws:
FtpException - if underlayed I/O or FTP error occurs.

setSendBufferSize

public abstract void setSendBufferSize(int sendBufferSize)
Sets the send buffer size option of the ftp connection.

Parameters:
sendBufferSize - Send buffer size.

setReceiveBufferSize

public abstract void setReceiveBufferSize(int receiveBufferSize)
Sets the receive buffer size option of the ftp connection.

Parameters:
receiveBufferSize - Receive buffer size.

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved