Java Doc for FTPClient.java in  » Net » edtftpj » com » enterprisedt » net » ftp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » edtftpj » com.enterprisedt.net.ftp 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.enterprisedt.net.ftp.FTPClient

FTPClient
public class FTPClient implements FTPClientInterface(Code)
Supports client-side FTP. Most common FTP operations are present in this class.
author:
   Bruce Blackshaw
version:
   $Revision: 1.93 $


Field Summary
final public static  byteCARRIAGE_RETURN
    
final public static  intDEFAULT_BUFFER_SIZE
    
final public static  StringDEFAULT_ENCODING
    
public static  Locale[]DEFAULT_LISTING_LOCALES
    
final public static  intDEFAULT_MONITOR_INTERVAL
    
final public static  intDEFAULT_TIMEOUT
    
final public static  byte[]FTP_LINE_SEPARATOR
    
final public static  byteLINE_FEED
    
protected  FTPControlSocketcontrol
    
protected  StringcontrolEncoding
    
protected  intcontrolPort
     Control port number.
public static  StringcvsId
    
protected  FTPDataSocketdata
    
protected  booleandetectTransferMode
    
protected  DirectoryEmptyStringsdirEmptyStrings
    
protected  FileNotFoundStringsfileNotFoundStrings
    
protected  Stringid
    
protected  FTPReplylastReply
    
protected  FTPReplylastValidReply
    
protected  FTPMessageListenermessageListener
    
protected  FTPProgressMonitormonitor
    
protected  FTPProgressMonitorExmonitorEx
    
protected  longmonitorInterval
    
protected  InetAddressremoteAddr
     Address of the remote server.
protected  StringremoteHost
    
protected  intserverWakeupInterval
     Interval in seconds in between server wakeups.
protected  inttimeout
     Socket timeout for both data and control.
protected  inttransferBufferSize
    
protected  TransferCompleteStringstransferCompleteStrings
    
protected  FTPTransferTypetransferType
    

Constructor Summary
public  FTPClient(String remoteHost)
     Constructor.
public  FTPClient(String remoteHost, int controlPort)
     Constructor.
public  FTPClient(String remoteHost, int controlPort, int timeout)
     Constructor.
public  FTPClient(String remoteHost, int controlPort, int timeout, String encoding)
     Constructor.
public  FTPClient(InetAddress remoteAddr)
     Constructor.
public  FTPClient(InetAddress remoteAddr, int controlPort)
     Constructor.
public  FTPClient(InetAddress remoteAddr, int controlPort, int timeout)
     Constructor.
public  FTPClient(InetAddress remoteAddr, int controlPort, int timeout, String encoding)
     Constructor.
public  FTPClient()
     Default constructor should now always be used together with setter methods in preference to other constructors (now deprecated).

Method Summary
protected  voidabort()
    
public  voidaccount(String accountInfo)
     Supply account information string to the server.
public  voidcancelResume()
    
public  voidcancelTransfer()
    
public  voidcdup()
    
public  voidchdir(String dir)
    
protected  voidcheckConnection(boolean shouldBeConnected)
     Checks if the client has connected to the server and throws an exception if it hasn't.
protected  voidchooseTransferMode(String filename)
    
public static  voidclearSOCKS()
     Clear SOCKS settings.
protected  voidcloseDataSocket(InputStream stream)
     Close stream for data socket.
protected  voidcloseDataSocket(OutputStream stream)
    
public  voidconnect()
     Connects to the server at the address and port number defined in the constructor.
public  booleanconnected()
    
public  voiddebugResponses(boolean on)
    
public  voiddelete(String remoteFile)
    
public  String[]dir()
    
public  String[]dir(String dirname)
    
public  String[]dir(String dirname, boolean full)
    
public  FTPFile[]dirDetails(String dirname)
    
public  booleanexists(String remoteFile)
    
public  String[]features()
    
public  FTPFilefileDetails(String name)
     Uses the MLST command to find out details about the named file.
protected  voidforceResumeOff()
     Force the resume flag off.
public  voidget(String localPath, String remoteFile)
    
public  voidget(OutputStream destStream, String remoteFile)
    
public  byte[]get(String remoteFile)
    
public  intgetActiveHighPort()
     Get the upper limit of the port range for active mode.
public  StringgetActiveIPAddress()
     Get the active IP address that is set.
public  intgetActiveLowPort()
     Get the lower limit of the port range for active mode.
public static  StringgetBuildTimestamp()
    
public  FTPConnectModegetConnectMode()
    
public  StringgetControlEncoding()
    
public  intgetControlPort()
     Returns the control-port being connected to on the remote server.
public  intgetDeleteCount()
    
public  booleangetDetectTransferMode()
    
public  DirectoryEmptyStringsgetDirectoryEmptyMessages()
     Get class that holds fragments of server messages that indicate a directory is empty.
public  intgetDownloadCount()
    
public  FileNotFoundStringsgetFileNotFoundMessages()
     Get class that holds fragments of server messages that indicate a file was not found.
public  StringgetId()
    
 InputStreamgetInputStream()
     Get the data input stream.
public  FTPReplygetLastReply()
    
public  FTPReplygetLastValidReply()
    
public  booleangetListenOnAllInterfaces()
    
public  FTPMessageListenergetMessageListener()
    
public  longgetMonitorInterval()
    
 OutputStreamgetOutputStream()
     Get the data input stream.
 StringgetPASVAddress(String pasvReply)
    
public  FTPProgressMonitorgetProgressMonitor()
    
public  FTPProgressMonitorExgetProgressMonitorEx()
    
public  InetAddressgetRemoteAddr()
    
public  StringgetRemoteHost()
    
 StringgetRemoteHostName()
    
public  intgetRemotePort()
     Returns the control-port being connected to on the remote server.
public  intgetServerWakeupInterval()
     Get server wakeup interval in seconds.
public  intgetTimeout()
    
public  intgetTransferBufferSize()
    
public  TransferCompleteStringsgetTransferCompleteMessages()
     Get class that holds fragments of server messages that indicate a transfer completed.
public  FTPTransferTypegetType()
     Get the current transfer type the current type of the transfer,i.e.
public  intgetUploadCount()
    
public static  int[]getVersion()
    
public  Stringhelp(String command)
    
protected  voidinitGet(String remoteFile)
    
protected  StringinitPut(String remoteFile, boolean append)
    
public static  voidinitSOCKS(String port, String host)
     Set up SOCKS v4/v5 proxy settings.
public static  voidinitSOCKSAuthentication(String username, String password)
     Set up SOCKS username and password for SOCKS username/password authentication.
protected  voidinitialize(FTPControlSocket control)
    
public  booleanisAutoPassiveIPSubstitution()
    
public  booleanisDeleteOnFailure()
    
public  booleanisStrictReturnCodes()
     Determine if strict checking of return codes is switched on.
public  booleanisTransferCancelled()
    
public  voidkeepAlive()
    
public  Stringlist(String dirname)
    
public  Stringlist(String dirname, boolean full)
     List a directory's contents as one string.
public  voidlogin(String user, String password)
     Login into an account on the FTP server.
public  voidlogin(String user, String password, String accountInfo)
     Login into an account on the FTP server.
public  voidmkdir(String dir)
    
public  Datemodtime(String remoteFile)
    
public  voidnoOperation()
     Send a "no operation" message that does nothing.
public  voidpassword(String password)
     Supplies the password for a previously supplied username to log into the FTP server.
public  Stringput(String localPath, String remoteFile)
    
public  Stringput(InputStream srcStream, String remoteFile)
    
public  Stringput(String localPath, String remoteFile, boolean append)
    
public  Stringput(InputStream srcStream, String remoteFile, boolean append)
    
public  Stringput(byte[] bytes, String remoteFile)
    
public  Stringput(byte[] bytes, String remoteFile, boolean append)
    
public  Stringpwd()
    
public  voidquit()
    
public  voidquitImmediately()
    
public  Stringquote(String command, String[] validCodes)
     Issue arbitrary ftp commands to the FTP server.
Parameters:
  command - ftp command to be sent to server
Parameters:
  validCodes - valid return codes for this command.
public  Stringquote(String command)
     Issue arbitrary ftp commands to the FTP server.
protected  intreadChar(LineNumberReader in)
     Attempts to read a single character from the given InputStream.
public  intreadChunk(BufferedInputStream in, byte[] chunk, int chunksize)
     Attempts to read a specified number of bytes from the given InputStream and place it in the given byte-array.
protected  StringreadLine(LineNumberReader in)
     Attempts to read a single line from the given InputStream.
 FTPReplyreadReply()
    
public  voidrename(String from, String to)
    
public  voidresetDeleteCount()
     Reset the count of deleted files to zero.
public  voidresetDownloadCount()
     Reset the count of downloaded files to zero.
public  voidresetTransferMode(FTPTransferType previousType)
     Reset the transfer mode back to what it should be, if it has changed.
public  voidresetUploadCount()
     Reset the count of uploaded files to zero.
public  voidrestart(long size)
     Issue the RESTart command to the remote server.
public  voidresume()
    
public  voidrmdir(String dir)
    
public  FTPReplysendCommand(String command)
    
public  voidsendServerWakeup()
     Wake up the server during a transfer to prevent a timeout from occuring.
public  voidsetActiveIPAddress(String activeIP)
     We can force PORT to send a fixed IP address, which can be useful with certain NAT configurations.
public  voidsetActivePortRange(int lowest, int highest)
     Force a certain range of ports to be used in active mode.
public  voidsetAutoPassiveIPSubstitution(boolean autoPassiveIPSubstitution)
    
public  voidsetConnectMode(FTPConnectMode mode)
    
public  voidsetControlEncoding(String controlEncoding)
     Set the control socket's encoding.
public  voidsetControlPort(int controlPort)
     Set the control to connect to on the remote server.
public  voidsetDeleteOnFailure(boolean deleteOnFailure)
    
public  voidsetDetectTransferMode(boolean detectTransferMode)
    
public  voidsetDirectoryEmptyMessages(DirectoryEmptyStrings dirEmptyStrings)
    
public  voidsetFTPFileFactory(FTPFileFactory fileFactory)
    
public  voidsetFileNotFoundMessages(FileNotFoundStrings fileNotFoundStrings)
    
public  voidsetForceUniqueNames(boolean forceUnique)
     Set to true if the STOU command is always to be used when uploading files, even if a filename is supplied.
public  voidsetId(String id)
    
public  voidsetListenOnAllInterfaces(boolean listenOnAll)
     Listen on all interfaces for active mode transfers (the default).
public  voidsetMessageListener(FTPMessageListener listener)
    
public  voidsetMonitorInterval(long interval)
    
public  voidsetPORTIP(String IPAddress)
     We can force PORT to send a fixed IP address, which can be useful with certain NAT configurations.
public  voidsetParserLocale(Locale locale)
    
public  voidsetParserLocales(Locale[] locales)
    
public  voidsetProgressMonitor(FTPProgressMonitor monitor, long interval)
    
public  voidsetProgressMonitor(FTPProgressMonitor monitor)
    
public  voidsetProgressMonitorEx(FTPProgressMonitorEx monitorEx)
    
public  voidsetRemoteAddr(InetAddress remoteAddr)
    
public  voidsetRemoteHost(String remoteHost)
    
public  voidsetRemotePort(int remotePort)
     Set the control to connect to on the remote server.
public  voidsetServerWakeupInterval(int interval)
     Set server wakeup interval in seconds.
public  voidsetStrictReturnCodes(boolean strict)
     Set strict checking of FTP return codes.
public  voidsetTimeout(int millis)
     Set the SO_TIMEOUT in milliseconds on the underlying socket. If set this means the socket will block in a read operation only for this length of time - useful if the FTP sever has hung, for example.
public  voidsetTransferBufferSize(int size)
    
public  voidsetTransferCompleteMessages(TransferCompleteStrings transferCompleteStrings)
    
public  voidsetType(FTPTransferType type)
    
protected  voidsetupDataSocket()
    
public  booleansite(String command)
     Run a site-specific command on the server.
public  longsize(String remoteFile)
    
public  Stringstat()
     Sends stat message to enquire about the status of a transfer.
public  Stringsystem()
    
public  StringtoString()
    
public  voiduser(String user)
     Supply the user name to log into an account on the FTP server.
public  voidvalidateReply(FTPReply reply, String expectedReplyCode)
    
public  voidvalidateReply(FTPReply reply, String[] expectedReplyCodes)
    
public  voidvalidateTransfer()
     Validate that the put() or get() was successful.
protected  voidvalidateTransferOnError(IOException ex)
     Validate a transfer when an error has occurred on the data channel. Set a very short transfer in case things have hung.

Field Detail
CARRIAGE_RETURN
final public static byte CARRIAGE_RETURN(Code)
Used for ASCII translation



DEFAULT_BUFFER_SIZE
final public static int DEFAULT_BUFFER_SIZE(Code)
Default transfer buffer size



DEFAULT_ENCODING
final public static String DEFAULT_ENCODING(Code)
Default encoding used for control data



DEFAULT_LISTING_LOCALES
public static Locale[] DEFAULT_LISTING_LOCALES(Code)
Default locales



DEFAULT_MONITOR_INTERVAL
final public static int DEFAULT_MONITOR_INTERVAL(Code)
Default byte interval for transfer monitor



DEFAULT_TIMEOUT
final public static int DEFAULT_TIMEOUT(Code)
Default timeout



FTP_LINE_SEPARATOR
final public static byte[] FTP_LINE_SEPARATOR(Code)
Used for ASCII translation



LINE_FEED
final public static byte LINE_FEED(Code)
Used for ASCII translation



control
protected FTPControlSocket control(Code)
Socket responsible for controlling the connection



controlEncoding
protected String controlEncoding(Code)
Encoding used on control socket



controlPort
protected int controlPort(Code)
Control port number.



cvsId
public static String cvsId(Code)
Revision control id



data
protected FTPDataSocket data(Code)
Socket responsible for transferring the data



detectTransferMode
protected boolean detectTransferMode(Code)
If true, filetypes are autodetected and transfer mode changed to binary/ASCII as required



dirEmptyStrings
protected DirectoryEmptyStrings dirEmptyStrings(Code)
Matcher for directory empty



fileNotFoundStrings
protected FileNotFoundStrings fileNotFoundStrings(Code)
Matcher for permission denied



id
protected String id(Code)
Id of instance



lastReply
protected FTPReply lastReply(Code)
Holds the last reply from the server on the control socket



lastValidReply
protected FTPReply lastValidReply(Code)
Holds the last valid reply from the server on the control socket



messageListener
protected FTPMessageListener messageListener(Code)
Message listener



monitor
protected FTPProgressMonitor monitor(Code)
Progress monitor



monitorEx
protected FTPProgressMonitorEx monitorEx(Code)
File transfer listener



monitorInterval
protected long monitorInterval(Code)
Bytes transferred in between monitor callbacks



remoteAddr
protected InetAddress remoteAddr(Code)
Address of the remote server.



remoteHost
protected String remoteHost(Code)
Name/IP of remote host



serverWakeupInterval
protected int serverWakeupInterval(Code)
Interval in seconds in between server wakeups. O is not enabled



timeout
protected int timeout(Code)
Socket timeout for both data and control. In milliseconds



transferBufferSize
protected int transferBufferSize(Code)
Size of transfer buffers



transferCompleteStrings
protected TransferCompleteStrings transferCompleteStrings(Code)
Matcher for transfer complete



transferType
protected FTPTransferType transferType(Code)
Record of the transfer type - make the default ASCII




Constructor Detail
FTPClient
public FTPClient(String remoteHost) throws IOException, FTPException(Code)
Constructor. Creates the control socket
Parameters:
  remoteHost - the remote hostname



FTPClient
public FTPClient(String remoteHost, int controlPort) throws IOException, FTPException(Code)
Constructor. Creates the control socket
Parameters:
  remoteHost - the remote hostname
Parameters:
  controlPort - port for control stream (-1 for default port)



FTPClient
public FTPClient(String remoteHost, int controlPort, int timeout) throws IOException, FTPException(Code)
Constructor. Creates the control socket
Parameters:
  remoteHost - the remote hostname
Parameters:
  controlPort - port for control stream (use -1 for the default port)
Parameters:
  timeout - the length of the timeout, in milliseconds(pass in 0 for no timeout)



FTPClient
public FTPClient(String remoteHost, int controlPort, int timeout, String encoding) throws IOException, FTPException(Code)
Constructor. Creates the control socket
Parameters:
  remoteHost - the remote hostname
Parameters:
  controlPort - port for control stream (use -1 for the default port)
Parameters:
  timeout - the length of the timeout, in milliseconds(pass in 0 for no timeout)
Parameters:
  encoding - character encoding used for data



FTPClient
public FTPClient(InetAddress remoteAddr) throws IOException, FTPException(Code)
Constructor. Creates the control socket
Parameters:
  remoteAddr - the address of theremote host



FTPClient
public FTPClient(InetAddress remoteAddr, int controlPort) throws IOException, FTPException(Code)
Constructor. Creates the control socket. Allows setting of control port (normally set by default to 21).
Parameters:
  remoteAddr - the address of theremote host
Parameters:
  controlPort - port for control stream



FTPClient
public FTPClient(InetAddress remoteAddr, int controlPort, int timeout) throws IOException, FTPException(Code)
Constructor. Creates the control socket. Allows setting of control port (normally set by default to 21).
Parameters:
  remoteAddr - the address of theremote host
Parameters:
  controlPort - port for control stream (-1 for default port)
Parameters:
  timeout - the length of the timeout, in milliseconds (pass in 0 for no timeout)



FTPClient
public FTPClient(InetAddress remoteAddr, int controlPort, int timeout, String encoding) throws IOException, FTPException(Code)
Constructor. Creates the control socket. Allows setting of control port (normally set by default to 21).
Parameters:
  remoteAddr - the address of theremote host
Parameters:
  controlPort - port for control stream (-1 for default port)
Parameters:
  timeout - the length of the timeout, in milliseconds (pass in 0 for no timeout)
Parameters:
  encoding - character encoding used for data



FTPClient
public FTPClient()(Code)
Default constructor should now always be used together with setter methods in preference to other constructors (now deprecated). The FTPClient.connect() method is used to perform the actual connection to the remote host - but only for this constructor. Deprecated constructors connect in the constructor and connect() is not required (and cannot be called).




Method Detail
abort
protected void abort() throws IOException, FTPException(Code)
Abort the current action



account
public void account(String accountInfo) throws IOException, FTPException(Code)
Supply account information string to the server. This can be used for a variety of purposes - for example, the server could indicate that a password has expired (by sending 332 in reply to PASS) and a new password automatically supplied via ACCT. It is up to the server how it uses this string.
Parameters:
  accountInfo - account information string



cancelResume
public void cancelResume() throws IOException, FTPException(Code)



cancelTransfer
public void cancelTransfer()(Code)



cdup
public void cdup() throws IOException, FTPException(Code)



chdir
public void chdir(String dir) throws IOException, FTPException(Code)



checkConnection
protected void checkConnection(boolean shouldBeConnected) throws FTPException(Code)
Checks if the client has connected to the server and throws an exception if it hasn't. This is only intended to be used by subclasses
throws:
  FTPException - Thrown if the client has not connected to the server.



chooseTransferMode
protected void chooseTransferMode(String filename) throws IOException, FTPException(Code)
Switch the transfer mode if requested and if necessary
Parameters:
  filename - filename of file to be transferred
throws:
  FTPException -
throws:
  IOException -



clearSOCKS
public static void clearSOCKS()(Code)
Clear SOCKS settings. Note that setting these properties affects all TCP sockets in this JVM



closeDataSocket
protected void closeDataSocket(InputStream stream)(Code)
Close stream for data socket. Not for general use!
Parameters:
  stream - stream reference



closeDataSocket
protected void closeDataSocket(OutputStream stream)(Code)
Close stream for data socket
Parameters:
  stream - stream reference



connect
public void connect() throws IOException, FTPException(Code)
Connects to the server at the address and port number defined in the constructor. Must be performed before login() or user() is called.
throws:
  IOException - Thrown if there is a TCP/IP-related error.
throws:
  FTPException - Thrown if there is an error related to the FTP protocol.



connected
public boolean connected()(Code)
Is this client connected? true if connected, false otherwise



debugResponses
public void debugResponses(boolean on)(Code)
Switch debug of responses on or off
Parameters:
  on - true if you wish to have responses tothe log stream, false otherwise



delete
public void delete(String remoteFile) throws IOException, FTPException(Code)



dir
public String[] dir() throws IOException, FTPException(Code)



dir
public String[] dir(String dirname) throws IOException, FTPException(Code)



dir
public String[] dir(String dirname, boolean full) throws IOException, FTPException(Code)



dirDetails
public FTPFile[] dirDetails(String dirname) throws IOException, FTPException, ParseException(Code)



exists
public boolean exists(String remoteFile) throws IOException, FTPException(Code)



features
public String[] features() throws IOException, FTPException(Code)
Get the server supplied features string containing server features, or null if no features or notsupported



fileDetails
public FTPFile fileDetails(String name) throws IOException, FTPException, ParseException(Code)
Uses the MLST command to find out details about the named file. A single filename should be supplied. Note that the MLST command is not supported by many servers.
Parameters:
  name - name of a file if it exists, an FTPFile object



forceResumeOff
protected void forceResumeOff()(Code)
Force the resume flag off. Internal use only.



get
public void get(String localPath, String remoteFile) throws IOException, FTPException(Code)



get
public void get(OutputStream destStream, String remoteFile) throws IOException, FTPException(Code)



get
public byte[] get(String remoteFile) throws IOException, FTPException(Code)



getActiveHighPort
public int getActiveHighPort()(Code)
Get the upper limit of the port range for active mode. upper limit, or -1 if not set



getActiveIPAddress
public String getActiveIPAddress()(Code)
Get the active IP address that is set. active IP address or null if not set



getActiveLowPort
public int getActiveLowPort()(Code)
Get the lower limit of the port range for active mode. lower limit, or -1 if not set



getBuildTimestamp
public static String getBuildTimestamp()(Code)
Get the build timestamp d-MMM-yyyy HH:mm:ss z build timestamp



getConnectMode
public FTPConnectMode getConnectMode()(Code)
Returns the connectMode.



getControlEncoding
public String getControlEncoding()(Code)
Get the encoding used for the control connection Returns the current controlEncoding.



getControlPort
public int getControlPort()(Code)
Returns the control-port being connected to on the remote server. Returns the port being connected to on the remote server. com.enterprisedt.net.ftp.FTPClientInterface.getRemotePort



getDeleteCount
public int getDeleteCount()(Code)
Get the number of files deleted since the count was reset deleted file count



getDetectTransferMode
public boolean getDetectTransferMode()(Code)



getDirectoryEmptyMessages
public DirectoryEmptyStrings getDirectoryEmptyMessages()(Code)
Get class that holds fragments of server messages that indicate a directory is empty. New messages can be added.

The fragments are used when it is necessary to examine the message returned by a server to see if it is saying a directory is empty. If an FTP server is returning a different message that still clearly indicates a directory is empty, use this property to add a new server fragment to the repository via the add method. It would be helpful to email support at enterprisedt dot com to inform us of the message so it can be added to the next build. messages class




getDownloadCount
public int getDownloadCount()(Code)
Get the number of files downloaded since the count was reset download file count



getFileNotFoundMessages
public FileNotFoundStrings getFileNotFoundMessages()(Code)
Get class that holds fragments of server messages that indicate a file was not found. New messages can be added.

The fragments are used when it is necessary to examine the message returned by a server to see if it is saying a file was not found. If an FTP server is returning a different message that still clearly indicates a file was not found, use this property to add a new server fragment to the repository via the add method. It would be helpful to email support at enterprisedt dot com to inform us of the message so it can be added to the next build. messages class




getId
public String getId()(Code)
Get the identifying string for this instance



getInputStream
InputStream getInputStream() throws IOException(Code)
Get the data input stream. Not for general use!
throws:
  IOException -



getLastReply
public FTPReply getLastReply()(Code)
Gets the last reply from the server, whether valid or not reply object encapsulating last server response



getLastValidReply
public FTPReply getLastValidReply()(Code)
Gets the latest valid reply from the server reply object encapsulating last valid server response



getListenOnAllInterfaces
public boolean getListenOnAllInterfaces()(Code)
Are we listening on all interfaces in active mode, which is the default? true if listening on all interfaces, false if listening just on the control interface



getMessageListener
public FTPMessageListener getMessageListener()(Code)
Returns the messageListener.



getMonitorInterval
public long getMonitorInterval()(Code)



getOutputStream
OutputStream getOutputStream() throws IOException(Code)
Get the data input stream. Not for general use!
throws:
  IOException -



getPASVAddress
String getPASVAddress(String pasvReply)(Code)
Get the PASV address string (including port numbers)
Parameters:
  pasvReply -



getProgressMonitor
public FTPProgressMonitor getProgressMonitor()(Code)
Get the reference to the progress monitor progress monitor



getProgressMonitorEx
public FTPProgressMonitorEx getProgressMonitorEx()(Code)
Get reference to the transfer listener FTPProgressMonitorEx



getRemoteAddr
public InetAddress getRemoteAddr()(Code)
Returns the remoteAddr.



getRemoteHost
public String getRemoteHost()(Code)



getRemoteHostName
String getRemoteHostName()(Code)
Get the name of the remote host remote host name



getRemotePort
public int getRemotePort()(Code)
Returns the control-port being connected to on the remote server. Note that this method replaces FTPClient.getControlPort() . Returns the port being connected to on the remote server.



getServerWakeupInterval
public int getServerWakeupInterval()(Code)
Get server wakeup interval in seconds. A value of 0 means it is disabled (the default). interval in seconds



getTimeout
public int getTimeout()(Code)
Get the TCP timeout timeout that is used, in milliseconds



getTransferBufferSize
public int getTransferBufferSize()(Code)
Get the size of the buffers used in writing to and reading from the data sockets transfer buffer size



getTransferCompleteMessages
public TransferCompleteStrings getTransferCompleteMessages()(Code)
Get class that holds fragments of server messages that indicate a transfer completed. New messages can be added.

The fragments are used when it is necessary to examine the message returned by a server to see if it is saying a transfer completed. If an FTP server is returning a different message that still clearly indicates a transfer failed, use this property to add a new server fragment to the repository via the add method. It would be helpful to email support at enterprisedt dot com to inform us of the message so it can be added to the next build. messages class




getType
public FTPTransferType getType()(Code)
Get the current transfer type the current type of the transfer,i.e. BINARY or ASCII



getUploadCount
public int getUploadCount()(Code)
Get the number of files uploaded since the count was reset upload file count



getVersion
public static int[] getVersion()(Code)
Get the version of edtFTPj int array of {major,middle,minor} version numbers



help
public String help(String command) throws IOException, FTPException(Code)
Get the help text for the specified command
Parameters:
  command - name of the command to get help on help text from the server for the supplied command



initGet
protected void initGet(String remoteFile) throws IOException, FTPException(Code)
Request to the server that the get is set up
Parameters:
  remoteFile - name of remote file



initPut
protected String initPut(String remoteFile, boolean append) throws IOException, FTPException(Code)
Request the server to set up the put
Parameters:
  remoteFile - name of remote file in current directory
Parameters:
  append - true if appending, false otherwise



initSOCKS
public static void initSOCKS(String port, String host)(Code)
Set up SOCKS v4/v5 proxy settings. This can be used if there is a SOCKS proxy server in place that must be connected thru. Note that setting these properties directs all TCP sockets in this JVM to the SOCKS proxy
Parameters:
  port - SOCKS proxy port
Parameters:
  host - SOCKS proxy hostname



initSOCKSAuthentication
public static void initSOCKSAuthentication(String username, String password)(Code)
Set up SOCKS username and password for SOCKS username/password authentication. Often, no authentication will be required but the SOCKS server may be configured to request these.
Parameters:
  username - the SOCKS username
Parameters:
  password - the SOCKS password



initialize
protected void initialize(FTPControlSocket control) throws IOException(Code)
Set the control socket explicitly
Parameters:
  control - control socket reference



isAutoPassiveIPSubstitution
public boolean isAutoPassiveIPSubstitution()(Code)
Is automatic substitution of the remote host IP set to be on for passive mode connections? true if set on, false otherwise



isDeleteOnFailure
public boolean isDeleteOnFailure()(Code)
If true, delete partially written files when exceptions are thrown during a download true if delete local file on error



isStrictReturnCodes
public boolean isStrictReturnCodes()(Code)
Determine if strict checking of return codes is switched on. If it is (the default), all return codes must exactly match the expected code. If strict checking is off, only the first digit must match. true if strict return code checking, false if non-strict.



isTransferCancelled
public boolean isTransferCancelled()(Code)
Has the current transfer been cancelled? true if cancel, false otherwise



keepAlive
public void keepAlive() throws IOException, FTPException(Code)
Tries to keep the current connection alive by sending an innocuous commmand to signal that the client is still active



list
public String list(String dirname) throws IOException, FTPException(Code)
List a directory's contents
Parameters:
  dirname - the name of the directory (not a file mask) a string containing the line separateddirectory listingFTPClient.dir(String)



list
public String list(String dirname, boolean full) throws IOException, FTPException(Code)
List a directory's contents as one string. A detailed listing is available, otherwise just filenames are provided. The detailed listing varies in details depending on OS and FTP server.
Parameters:
  dirname - the name of the directory(not a file mask)
Parameters:
  full - true if detailed listing requiredfalse otherwise a string containing the line separateddirectory listingFTPClient.dir(String,boolean)



login
public void login(String user, String password) throws IOException, FTPException(Code)
Login into an account on the FTP server. This call completes the entire login process. Note that connect() must be called first.
Parameters:
  user - user name
Parameters:
  password - user's password



login
public void login(String user, String password, String accountInfo) throws IOException, FTPException(Code)
Login into an account on the FTP server. This call completes the entire login process. This method permits additional account information to be supplied. FTP servers can use combinations of these parameters in many different ways, e.g. to pass in proxy details via this method, some servers use the "user" as 'ftpUser + "@" + ftpHost + " " + ftpProxyUser', the "password" as the FTP user's password, and the accountInfo as the proxy password. Note that connect() must be called first.
Parameters:
  user - user name
Parameters:
  password - user's password
Parameters:
  accountInfo - account info string



mkdir
public void mkdir(String dir) throws IOException, FTPException(Code)



modtime
public Date modtime(String remoteFile) throws IOException, FTPException(Code)



noOperation
public void noOperation() throws IOException, FTPException(Code)
Send a "no operation" message that does nothing. Can be called periodically to prevent the connection timing out



password
public void password(String password) throws IOException, FTPException(Code)
Supplies the password for a previously supplied username to log into the FTP server. Must be preceeded by the user() method
Parameters:
  password - The password.



put
public String put(String localPath, String remoteFile) throws IOException, FTPException(Code)



put
public String put(InputStream srcStream, String remoteFile) throws IOException, FTPException(Code)



put
public String put(String localPath, String remoteFile, boolean append) throws IOException, FTPException(Code)



put
public String put(InputStream srcStream, String remoteFile, boolean append) throws IOException, FTPException(Code)



put
public String put(byte[] bytes, String remoteFile) throws IOException, FTPException(Code)



put
public String put(byte[] bytes, String remoteFile, boolean append) throws IOException, FTPException(Code)



pwd
public String pwd() throws IOException, FTPException(Code)



quit
public void quit() throws IOException, FTPException(Code)



quitImmediately
public void quitImmediately() throws IOException, FTPException(Code)



quote
public String quote(String command, String[] validCodes) throws IOException, FTPException(Code)
Issue arbitrary ftp commands to the FTP server.
Parameters:
  command - ftp command to be sent to server
Parameters:
  validCodes - valid return codes for this command. If nullis supplied no validation is performed the text returned by the FTP server



quote
public String quote(String command) throws IOException, FTPException(Code)
Issue arbitrary ftp commands to the FTP server.
Parameters:
  command - ftp command to be sent to server the raw text returned by the FTP server including reply code



readChar
protected int readChar(LineNumberReader in) throws IOException(Code)
Attempts to read a single character from the given InputStream. The purpose of this method is to permit subclasses to execute any additional code necessary when performing this operation.
Parameters:
  in - The LineNumberReader to read from. The character read.
throws:
  IOException - Thrown if there was an error while reading.



readChunk
public int readChunk(BufferedInputStream in, byte[] chunk, int chunksize) throws IOException(Code)
Attempts to read a specified number of bytes from the given InputStream and place it in the given byte-array. The purpose of this method is to permit subclasses to execute any additional code necessary when performing this operation.
Parameters:
  in - The InputStream to read from.
Parameters:
  chunk - The byte-array to place read bytes in.
Parameters:
  chunksize - Number of bytes to read. Number of bytes actually read.
throws:
  IOException - Thrown if there was an error while reading.



readLine
protected String readLine(LineNumberReader in) throws IOException(Code)
Attempts to read a single line from the given InputStream. The purpose of this method is to permit subclasses to execute any additional code necessary when performing this operation.
Parameters:
  in - The LineNumberReader to read from. The string read.
throws:
  IOException - Thrown if there was an error while reading.



readReply
FTPReply readReply() throws IOException(Code)
Read reply from control socket
throws:
  IOException -



rename
public void rename(String from, String to) throws IOException, FTPException(Code)



resetDeleteCount
public void resetDeleteCount()(Code)
Reset the count of deleted files to zero.



resetDownloadCount
public void resetDownloadCount()(Code)
Reset the count of downloaded files to zero.



resetTransferMode
public void resetTransferMode(FTPTransferType previousType) throws IOException, FTPException(Code)
Reset the transfer mode back to what it should be, if it has changed.
Parameters:
  previousType - previous transfer type
throws:
  IOException -
throws:
  FTPException -



resetUploadCount
public void resetUploadCount()(Code)
Reset the count of uploaded files to zero.



restart
public void restart(long size) throws IOException, FTPException(Code)
Issue the RESTart command to the remote server. This indicates the byte position that REST is performed at. For put, bytes start at this point, while for get, bytes are fetched from this point.
Parameters:
  size - the REST param, the mark at which the restart is performed on the remote file. For STOR, this is retrievedby SIZE
throws:
  IOException -
throws:
  FTPException -



resume
public void resume() throws FTPException(Code)



rmdir
public void rmdir(String dir) throws IOException, FTPException(Code)



sendCommand
public FTPReply sendCommand(String command) throws IOException(Code)
Send a command to the server and get the reply
Parameters:
  command - command FTPReply
throws:
  IOException -



sendServerWakeup
public void sendServerWakeup() throws IOException, FTPException(Code)
Wake up the server during a transfer to prevent a timeout from occuring. This may hang or confuse the server - use with caution.
throws:
  IOException -
throws:
  FTPException -



setActiveIPAddress
public void setActiveIPAddress(String activeIP) throws FTPException(Code)
We can force PORT to send a fixed IP address, which can be useful with certain NAT configurations. Must be connected to the remote host to call this method.
Parameters:
  activeIP - IP address to force, in 192.168.1.0 form or in IPV6 form, e.g.1080::8:800:200C:417A



setActivePortRange
public void setActivePortRange(int lowest, int highest) throws FTPException(Code)
Force a certain range of ports to be used in active mode. This is generally so that a port range can be configured in a firewall. Note that if lowest == highest, a single port will be used. This works well for uploads, but downloads generally require multiple ports, as most servers fail to create a connection repeatedly for the same port.
Parameters:
  lowest - Lower limit of range.
Parameters:
  highest - Upper limit of range.



setAutoPassiveIPSubstitution
public void setAutoPassiveIPSubstitution(boolean autoPassiveIPSubstitution)(Code)
Set automatic substitution of the remote host IP on if in passive mode
Parameters:
  autoPassiveIPSubstitution - true if set to on, false otherwise



setConnectMode
public void setConnectMode(FTPConnectMode mode)(Code)
Set the connect mode
Parameters:
  mode - ACTIVE or PASV mode



setControlEncoding
public void setControlEncoding(String controlEncoding) throws FTPException(Code)
Set the control socket's encoding. Can only do this if not connected
Parameters:
  controlEncoding - The controlEncoding to set, which is the name of a Charset
See Also:   java.nio.charset.Charset
throws:
  FTPException -



setControlPort
public void setControlPort(int controlPort) throws FTPException(Code)
Set the control to connect to on the remote server. Can only do this if not already connected.
Parameters:
  controlPort - The port to use.
throws:
  FTPException - Thrown if the client is already connected to the server.com.enterprisedt.net.ftp.FTPClientInterface.setRemotePort(int)



setDeleteOnFailure
public void setDeleteOnFailure(boolean deleteOnFailure)(Code)
Switch on or off the automatic deletion of partially written files that are left when an exception is thrown during a download
Parameters:
  deleteOnFailure - true if delete when a failure occurs



setDetectTransferMode
public void setDetectTransferMode(boolean detectTransferMode)(Code)



setDirectoryEmptyMessages
public void setDirectoryEmptyMessages(DirectoryEmptyStrings dirEmptyStrings)(Code)
Set a new instance of the strings class
Parameters:
  dirEmptyStrings - new instance



setFTPFileFactory
public void setFTPFileFactory(FTPFileFactory fileFactory)(Code)
Override the chosen file factory with a user created one - meaning that a specific parser has been selected
Parameters:
  fileFactory -



setFileNotFoundMessages
public void setFileNotFoundMessages(FileNotFoundStrings fileNotFoundStrings)(Code)
Set a new instance of the strings class
Parameters:
  fileNotFoundStrings - new instance



setForceUniqueNames
public void setForceUniqueNames(boolean forceUnique)(Code)
Set to true if the STOU command is always to be used when uploading files, even if a filename is supplied. Normally STOU is only used if the supplied remote filename is null or the empty string.
Parameters:
  forceUnique - true if STOU is always to be used



setId
public void setId(String id)(Code)
Set the identifying string for this instance
Parameters:
  id - identifying string



setListenOnAllInterfaces
public void setListenOnAllInterfaces(boolean listenOnAll)(Code)
Listen on all interfaces for active mode transfers (the default).
Parameters:
  listenOnAll - true if listen on all interfaces, false to listen on the control interface



setMessageListener
public void setMessageListener(FTPMessageListener listener)(Code)
Set a listener that handles all FTP messages
Parameters:
  listener - message listener



setMonitorInterval
public void setMonitorInterval(long interval)(Code)
Set the number of bytes transferred between each callback on the progress monitor param interval bytes to be transferred before a callback



setPORTIP
public void setPORTIP(String IPAddress) throws FTPException(Code)
We can force PORT to send a fixed IP address, which can be useful with certain NAT configurations. Must be connected to the remote host to call this method.
Parameters:
  IPAddress - IP address to force, in 192.168.1.0 form



setParserLocale
public void setParserLocale(Locale locale)(Code)
Set the locale for date parsing of dir listings
Parameters:
  locale - new locale to use



setParserLocales
public void setParserLocales(Locale[] locales)(Code)
Set the list of locales to be tried for date parsing of dir listings
Parameters:
  locales - locales to use



setProgressMonitor
public void setProgressMonitor(FTPProgressMonitor monitor, long interval)(Code)



setProgressMonitor
public void setProgressMonitor(FTPProgressMonitor monitor)(Code)



setProgressMonitorEx
public void setProgressMonitorEx(FTPProgressMonitorEx monitorEx)(Code)
Set reference to the transfer listener
Parameters:
  monitorEx - transfer listener



setRemoteAddr
public void setRemoteAddr(InetAddress remoteAddr) throws FTPException(Code)
Set the remote address
Parameters:
  remoteAddr - The remoteAddr to set.
throws:
  FTPException -



setRemoteHost
public void setRemoteHost(String remoteHost) throws IOException, FTPException(Code)



setRemotePort
public void setRemotePort(int remotePort) throws FTPException(Code)
Set the control to connect to on the remote server. Can only do this if not already connected. Note that this method replaces FTPClient.setControlPort(int) .
Parameters:
  remotePort - The port to use.
throws:
  FTPException - Thrown if the client is already connected to the server.



setServerWakeupInterval
public void setServerWakeupInterval(int interval)(Code)
Set server wakeup interval in seconds. A value of 0 means it is disabled (the default). This may hang or confuse the FTP server - use with caution.
Parameters:
  interval - interval in seconds



setStrictReturnCodes
public void setStrictReturnCodes(boolean strict)(Code)
Set strict checking of FTP return codes. If strict checking is on (the default) code must exactly match the expected code. If strict checking is off, only the first digit must match.
Parameters:
  strict - true for strict checking, false for loose checking



setTimeout
public void setTimeout(int millis) throws IOException(Code)
Set the SO_TIMEOUT in milliseconds on the underlying socket. If set this means the socket will block in a read operation only for this length of time - useful if the FTP sever has hung, for example. The default is 0, which is an infinite timeout. Note that for JREs 1.4+, the timeout is also used when first connecting to the remote host.
Parameters:
  millis - The length of the timeout, in milliseconds



setTransferBufferSize
public void setTransferBufferSize(int size)(Code)
Set the size of the buffers used in writing to and reading from the data sockets
Parameters:
  size - new size of buffer in bytes



setTransferCompleteMessages
public void setTransferCompleteMessages(TransferCompleteStrings transferCompleteStrings)(Code)
Set a new instance of the strings class
Parameters:
  transferCompleteStrings - new instance



setType
public void setType(FTPTransferType type) throws IOException, FTPException(Code)
Set the transfer type
Parameters:
  type - the transfer type toset the server to



setupDataSocket
protected void setupDataSocket() throws IOException, FTPException(Code)
Set up the data socket
throws:
  FTPException -
throws:
  IOException -



site
public boolean site(String command) throws IOException, FTPException(Code)
Run a site-specific command on the server. Support for commands is dependent on the server
Parameters:
  command - the site command to run true if command ok, false ifcommand not implemented



size
public long size(String remoteFile) throws IOException, FTPException(Code)



stat
public String stat() throws IOException, FTPException(Code)
Sends stat message to enquire about the status of a transfer.



system
public String system() throws IOException, FTPException(Code)
Get the type of the OS at the server the type of server OS



toString
public String toString()(Code)
String representation



user
public void user(String user) throws IOException, FTPException(Code)
Supply the user name to log into an account on the FTP server. Must be followed by the password() method - but we allow for no password. Note that connect() must be called first.
Parameters:
  user - user name



validateReply
public void validateReply(FTPReply reply, String expectedReplyCode) throws FTPException(Code)
Validate an FTPReply
Parameters:
  reply - reply object
Parameters:
  expectedReplyCode - expected code
throws:
  FTPException -



validateReply
public void validateReply(FTPReply reply, String[] expectedReplyCodes) throws FTPException(Code)
Validate an FTPReply
Parameters:
  reply - reply object
Parameters:
  expectedReplyCodes - expected codes
throws:
  FTPException -



validateTransfer
public void validateTransfer() throws IOException, FTPException(Code)
Validate that the put() or get() was successful. This method is not for general use.



validateTransferOnError
protected void validateTransferOnError(IOException ex) throws IOException, FTPException(Code)
Validate a transfer when an error has occurred on the data channel. Set a very short transfer in case things have hung. Set it back at the end.
throws:
  IOException -
throws:
  FTPException -



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.