Java Doc for FileTransferClient.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.FileTransferClient

FileTransferClient
public class FileTransferClient (Code)
Easy to use FTP client that is thread safe and provides true FTP streams. This class is intended to replace FTPClient, which will eventually be deprecated.
author:
   Bruce Blackshaw
version:
   $Revision: 1.3 $


Field Summary
protected  EventAggregatoreventAggregator
    
protected  EventListenerlistener
    
protected  ConnectionContextmasterContext
     Context for the client that is the starting point for all new tasks.

Constructor Summary
public  FileTransferClient()
    

Method Summary
public  voidcancelAllTransfers()
    
public synchronized  voidchangeDirectory(String directoryName)
     Change directory on the FTP server.
public synchronized  voidchangeToParentDirectory()
     Change to parent directory on the FTP server.
protected  voidcheckConnection(boolean shouldBeConnected)
     Checks if the client has connected to the server and throws an exception if it hasn't.
protected  voidcheckListingSettings()
    
protected  voidcheckTransferSettings()
    
protected  voidconfigureClient()
    
protected  voidconfigureTransferType(FTPTransferType type)
    
public synchronized  voidconnect()
     Make a connection to the FTP server.
public synchronized  voidcreateDirectory(String directoryName)
     Create directory on the FTP server.
public synchronized  voiddeleteDirectory(String directoryName)
     Create directory on the FTP server.
public synchronized  voiddeleteFile(String remoteFileName)
     Deletes a remote file.
public synchronized  FTPFile[]directoryList()
     List the current directory on the FTP server.
public synchronized  FTPFile[]directoryList(String directoryName)
     List a directory on the FTP server.
Parameters:
  directoryName - name of the directory (generally not a path).
public synchronized  String[]directoryNameList()
     List the names of files and directories in the current directory on the FTP server.
public synchronized  String[]directoryNameList(String directoryName, boolean isLongListing)
     List the names of files and directories of a directory on the FTP server.
Parameters:
  directoryName - name of the directory (generally not a path).
public synchronized  voiddisconnect()
     Disconnect from the FTP server.
public synchronized  voiddisconnect(boolean immediate)
     Disconnect from the FTP server.
public synchronized  byte[]downloadByteArray(String remoteFileName)
     Download a file from the FTP server into a byte array.
public synchronized  voiddownloadFile(String localFileName, String remoteFileName)
     Download a file from the FTP server .
public synchronized  voiddownloadFile(String localFileName, String remoteFileName, WriteMode writeMode)
     Download a file from the FTP server .
public synchronized  FileTransferInputStreamdownloadStream(String remoteFileName)
     Download a file from the FTP server as a stream.
public synchronized  StringexecuteCommand(String command)
     Request that the remote server execute the literal command supplied.
public synchronized  booleanexists(String remoteFileName)
     Determine if a remote file exists.
public synchronized  AdvancedFTPSettingsgetAdvancedFTPSettings()
    
public synchronized  FTPTransferTypegetContentType()
     Get the current content type for all connections.
public  booleangetDetectContentType()
    
public synchronized  DategetModifiedTime(String remoteFileName)
     Get the modified-time of a remote file.
public synchronized  StringgetPassword()
     Get the current user password.
public synchronized  StringgetRemoteDirectory()
     Get the current remote directory.
public synchronized  StringgetRemoteHost()
     Returns the IP address or name of the remote host.
public synchronized  intgetRemotePort()
     Returns the port being connected to on the remote server.
public synchronized  longgetSize(String remoteFileName)
     Get the size of a remote file.
public synchronized  FileStatisticsgetStatistics()
     Get statistics on file transfers and deletions.
public synchronized  StringgetSystemType()
     Get a string that represents the remote system that the client is logged into.
public synchronized  intgetTimeout()
     Returns the timeout for socket connections.
public synchronized  StringgetUserName()
     Get the current user name.
public synchronized  booleanisConnected()
    
public  voidmanualLogin()
     Perform a manual login using the credentials that have been set.
public synchronized  voidrename(String renameFromName, String renameToName)
     Rename a remote file or directory.
public synchronized  voidsetContentType(FTPTransferType type)
     Set the transfer type for all connections, either ASCII or binary.
public  voidsetDetectContentType(boolean detectContentType)
     Set auto detect of filetypes on or off.
public synchronized  voidsetEventListener(EventListener listener)
    
public synchronized  voidsetPassword(String password)
     Set the password of the user to log in with.
public synchronized  voidsetRemoteHost(String remoteHost)
     Set the IP address or name of the remote host This may only be done if the client is not already connected to the server.
public synchronized  voidsetRemotePort(int remotePort)
     Set the port to connect to on the remote server.
public synchronized  voidsetTimeout(int timeout)
     Set the timeout for socket connections.
public synchronized  voidsetUserName(String userName)
     Set the name of the user to log in with.
public synchronized  StringuploadFile(String localFileName, String remoteFileName)
     Upload a file to the FTP server.
public synchronized  StringuploadFile(String localFileName, String remoteFileName, WriteMode writeMode)
     Upload a file to the FTP server.
public synchronized  FileTransferOutputStreamuploadStream(String remoteFileName)
     Upload a file to the FTP server by writing to a stream.
public synchronized  FileTransferOutputStreamuploadStream(String remoteFileName, WriteMode writeMode)
     Upload a file to the FTP server by writing to a stream.

Field Detail
eventAggregator
protected EventAggregator eventAggregator(Code)



listener
protected EventListener listener(Code)
Event listeners



masterContext
protected ConnectionContext masterContext(Code)
Context for the client that is the starting point for all new tasks. If we have a change directory task, when it is completed it will update this master context and the updated context will be used for all future tasks




Constructor Detail
FileTransferClient
public FileTransferClient()(Code)
Default constructor




Method Detail
cancelAllTransfers
public void cancelAllTransfers()(Code)
Cancel current transfer if underway



changeDirectory
public synchronized void changeDirectory(String directoryName) throws FTPException, IOException(Code)
Change directory on the FTP server.
Parameters:
  directoryName - name the remote directory to change into
throws:
  FTPException - , IOException



changeToParentDirectory
public synchronized void changeToParentDirectory() throws FTPException, IOException(Code)
Change to parent directory on the FTP server.
throws:
  FTPException - , IOException



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.



checkListingSettings
protected void checkListingSettings() throws FTPException(Code)



checkTransferSettings
protected void checkTransferSettings() throws FTPException(Code)



configureClient
protected void configureClient() throws IOException, FTPException(Code)
Apply the master context's settings to the client
throws:
  IOException -
throws:
  FTPException -



configureTransferType
protected void configureTransferType(FTPTransferType type) throws IOException, FTPException(Code)



connect
public synchronized void connect() throws FTPException, IOException(Code)
Make a connection to the FTP server.
throws:
  FTPException -
throws:
  IOException -



createDirectory
public synchronized void createDirectory(String directoryName) throws FTPException, IOException(Code)
Create directory on the FTP server.
Parameters:
  directoryName - name the remote directory to create
throws:
  FTPException - , IOException



deleteDirectory
public synchronized void deleteDirectory(String directoryName) throws FTPException, IOException(Code)
Create directory on the FTP server. The directory must be empty. Note that edtFTPj/PRO supports recursive directory deletions.
Parameters:
  directoryName - name the remote directory to create
throws:
  FTPException - , IOException



deleteFile
public synchronized void deleteFile(String remoteFileName) throws FTPException, IOException(Code)
Deletes a remote file.
Parameters:
  remoteFileName - name of remote file
throws:
  FTPException -
throws:
  IOException -



directoryList
public synchronized FTPFile[] directoryList() throws FTPException, IOException, ParseException(Code)
List the current directory on the FTP server.
throws:
  FTPException - , IOException
throws:
  ParseException -



directoryList
public synchronized FTPFile[] directoryList(String directoryName) throws FTPException, IOException, ParseException(Code)
List a directory on the FTP server.
Parameters:
  directoryName - name of the directory (generally not a path). Some servers will accept a wildcard.
throws:
  FTPException - , IOException
throws:
  ParseException -



directoryNameList
public synchronized String[] directoryNameList() throws FTPException, IOException(Code)
List the names of files and directories in the current directory on the FTP server. String[]
throws:
  FTPException - , IOException



directoryNameList
public synchronized String[] directoryNameList(String directoryName, boolean isLongListing) throws FTPException, IOException(Code)
List the names of files and directories of a directory on the FTP server.
Parameters:
  directoryName - name of the directory (generally not a path). Some servers will accept a wildcard.
Parameters:
  isLongListing - true if the listing is a long format listing String[]
throws:
  FTPException - , IOException



disconnect
public synchronized void disconnect() throws FTPException, IOException(Code)
Disconnect from the FTP server.
throws:
  FTPException - , IOException



disconnect
public synchronized void disconnect(boolean immediate) throws FTPException, IOException(Code)
Disconnect from the FTP server.
throws:
  FTPException - , IOException



downloadByteArray
public synchronized byte[] downloadByteArray(String remoteFileName) throws FTPException, IOException(Code)
Download a file from the FTP server into a byte array.
Parameters:
  remoteFileName - name of the remote file to be downloaded
throws:
  FTPException -



downloadFile
public synchronized void downloadFile(String localFileName, String remoteFileName) throws FTPException, IOException(Code)
Download a file from the FTP server .
Parameters:
  localFileName - name (or full path) of the local file to be downloaded to
Parameters:
  remoteFileName - name of the remote file to be downloaded
throws:
  FTPException -



downloadFile
public synchronized void downloadFile(String localFileName, String remoteFileName, WriteMode writeMode) throws FTPException, IOException(Code)
Download a file from the FTP server .
Parameters:
  localFileName - name (or full path) of the local file to be downloaded to
Parameters:
  remoteFileName - name of the remote file to be downloaded
Parameters:
  writeMode - mode in which the file is written to the client machine
throws:
  FTPException -



downloadStream
public synchronized FileTransferInputStream downloadStream(String remoteFileName) throws FTPException, IOException(Code)
Download a file from the FTP server as a stream. The close() method must be called on the stream once the stream has been read.
Parameters:
  remoteFileName - name of the remote file to be downloaded InputStream
throws:
  FTPException -



executeCommand
public synchronized String executeCommand(String command) throws FTPException, IOException(Code)
Request that the remote server execute the literal command supplied. In FTP, this is the equivalent of 'quote'. It could be used to send a SITE command to the server, e.g. "SITE recfm=FB lrecl=180 blksize=5400".
Parameters:
  command - command string result string returned by server
throws:
  FTPException -
throws:
  IOException -



exists
public synchronized boolean exists(String remoteFileName) throws FTPException, IOException(Code)
Determine if a remote file exists.
Parameters:
  remoteFileName - name of remote file
throws:
  FTPException -



getAdvancedFTPSettings
public synchronized AdvancedFTPSettings getAdvancedFTPSettings()(Code)
Get the advanced configuration parameters object advanced parameters



getContentType
public synchronized FTPTransferType getContentType()(Code)
Get the current content type for all connections. transfer type



getDetectContentType
public boolean getDetectContentType()(Code)
Get the detect content type flag true if we are detecting binary and ASCII transfers from the file type



getModifiedTime
public synchronized Date getModifiedTime(String remoteFileName) throws FTPException, IOException(Code)
Get the modified-time of a remote file.
Parameters:
  remoteFileName - name of remote file Date
throws:
  FTPException -



getPassword
public synchronized String getPassword()(Code)
Get the current user password. current user password



getRemoteDirectory
public synchronized String getRemoteDirectory() throws IOException, FTPException(Code)
Get the current remote directory. current remote directory
throws:
  FTPException -
throws:
  IOException -



getRemoteHost
public synchronized String getRemoteHost()(Code)
Returns the IP address or name of the remote host. Returns the remote host.



getRemotePort
public synchronized int getRemotePort()(Code)
Returns the port being connected to on the remote server. Returns the port being connected to on the remote server.



getSize
public synchronized long getSize(String remoteFileName) throws FTPException, IOException(Code)
Get the size of a remote file.
Parameters:
  remoteFileName - name of remote file long
throws:
  FTPException -



getStatistics
public synchronized FileStatistics getStatistics()(Code)
Get statistics on file transfers and deletions. FTPStatistics



getSystemType
public synchronized String getSystemType() throws FTPException, IOException(Code)
Get a string that represents the remote system that the client is logged into. system string
throws:
  FTPException -
throws:
  IOException -



getTimeout
public synchronized int getTimeout()(Code)
Returns the timeout for socket connections. Returns the connection timeout in milliseconds



getUserName
public synchronized String getUserName()(Code)
Get the current user name. current user name



isConnected
public synchronized boolean isConnected()(Code)
Is this client currently connected to the server? true if connected, false otherwise



manualLogin
public void manualLogin() throws FTPException, IOException(Code)
Perform a manual login using the credentials that have been set. This should only be performed if auto login is disabled - normally connect() performs the login automatically.
throws:
  FTPException -
throws:
  IOException -



rename
public synchronized void rename(String renameFromName, String renameToName) throws FTPException, IOException(Code)
Rename a remote file or directory.
Parameters:
  renameFromName - original name
Parameters:
  renameToName - new name
throws:
  FTPException - , IOException



setContentType
public synchronized void setContentType(FTPTransferType type) throws IOException, FTPException(Code)
Set the transfer type for all connections, either ASCII or binary. Setting applies to all subsequent transfers that are initiated.
Parameters:
  type - transfer type
throws:
  FTPException -
throws:
  IOException -
throws:
  FTPException -



setDetectContentType
public void setDetectContentType(boolean detectContentType)(Code)
Set auto detect of filetypes on or off. If on, the transfer mode is switched from ASCII to binary and vice versa depending on the extension of the file. After the transfer, the mode is always returned to what it was before the transfer was performed. The default is off. If the filetype is unknown, the transfer mode is unchanged
Parameters:
  detectContentType - true if detecting content type, false if not



setEventListener
public synchronized void setEventListener(EventListener listener)(Code)
Set the event listener for transfer event notification
Parameters:
  listener - event listener reference



setPassword
public synchronized void setPassword(String password) throws FTPException(Code)
Set the password of the user to log in with. Can only do this if not already connected.
Parameters:
  password - password to log in with.
throws:
  FTPException -



setRemoteHost
public synchronized void setRemoteHost(String remoteHost) throws FTPException(Code)
Set the IP address or name of the remote host This may only be done if the client is not already connected to the server.
Parameters:
  remoteHost - The IP address or name of the remote host
throws:
  FTPException - Thrown if the client is already connected to the server.



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



setTimeout
public synchronized void setTimeout(int timeout) throws FTPException(Code)
Set the timeout for socket connections. Can only do this if not already connected.
Parameters:
  timeout - the timeout to use in milliseconds
throws:
  FTPException - Thrown if the client is already connected to the server.



setUserName
public synchronized void setUserName(String userName) throws FTPException(Code)
Set the name of the user to log in with. Can only do this if not already connected.
Parameters:
  userName - user-name to log in with.
throws:
  FTPException -



uploadFile
public synchronized String uploadFile(String localFileName, String remoteFileName) throws FTPException, IOException(Code)
Upload a file to the FTP server. If a null is supplied as the remoteFileName, the STOU (store unique) FTP feature will be used (if available) and the FTP server will generate a unique name for the file.
Parameters:
  localFileName - name (or full path) of the local file to be downloaded to
Parameters:
  remoteFileName - name of the remote file to be downloaded (or null to generate a unique name) name of remote file
throws:
  FTPException -



uploadFile
public synchronized String uploadFile(String localFileName, String remoteFileName, WriteMode writeMode) throws FTPException, IOException(Code)
Upload a file to the FTP server. If a null is supplied as the remoteFileName, the STOU (store unique) FTP feature will be used (if available) and the FTP server will generate a unique name for the file.
Parameters:
  localFileName - name (or full path) of the local file to be downloaded to
Parameters:
  remoteFileName - name of the remote file to be downloaded (or null to generate a unique name)
Parameters:
  writeMode - mode to write to the remote file with name of remote file
throws:
  FTPException -



uploadStream
public synchronized FileTransferOutputStream uploadStream(String remoteFileName) throws FTPException, IOException(Code)
Upload a file to the FTP server by writing to a stream. The close() method must be called on the stream once the stream has been read. If a null is supplied as the remoteFileName, the STOU (store unique) FTP feature will be used (if available) and the FTP server will generate a unique name for the file. This name can be obtained afterwards from
See Also:    FileTransferOutputStream#getRemoteFile()
Parameters:
  remoteFileName - name of the remote file to be uploaded FTPOutputStream
throws:
  FTPException -
throws:
  IOException -



uploadStream
public synchronized FileTransferOutputStream uploadStream(String remoteFileName, WriteMode writeMode) throws FTPException, IOException(Code)
Upload a file to the FTP server by writing to a stream. The close() method *must* be called on the stream once the stream has been read. If a null is supplied as the remoteFileName, the STOU (store unique) FTP feature will be used (if available) and the FTP server will generate a unique name for the file. This name can be obtained afterwards from
See Also:    FileTransferOutputStream#getRemoteFile()
Parameters:
  remoteFileName - name of the remote file to be uploaded
Parameters:
  writeMode - mode for writing to the server (supporting use of append) FTPOutputStream
throws:
  FTPException -
throws:
  IOException -



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.