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


com.enterprisedt.net.ftp.FTPClientInterface

All known Subclasses:   com.enterprisedt.net.ftp.FTPClient,  com.enterprisedt.net.ftp.test.FileTransferClientAdapter,
FTPClientInterface
public interface FTPClientInterface (Code)
Defines operations in common with a number of FTP implementations.
author:
   Hans Andersen
version:
   $Revision: 1.17 $




Method Summary
public  voidcancelResume()
     Cancel the resume.
public  voidcancelTransfer()
     Cancels the current transfer.
public  voidcdup()
    
public  voidchdir(String dir)
    
public  voidconnect()
     Connects to the server at the address and port number defined in the constructor.
throws:
  IOException - Thrown if there is a TCP/IP-related error.
throws:
  FTPException - Thrown if there is an error related to the FTP protocol.
public  booleanconnected()
    
public  voiddelete(String remoteFile)
    
public  String[]dir()
     List current directory's contents as an array of strings of filenames.
public  String[]dir(String dirname)
     List a directory's contents as an array of strings of filenames.
public  String[]dir(String dirname, boolean full)
     List a directory's contents as an array of strings.
public  FTPFile[]dirDetails(String dirname)
     List a directory's contents as an array of FTPFile objects. Should work for Windows and most Unix FTP servers - let us know about unusual formats (http://www.enterprisedt.com/forums/index.php). If accurate timestamps are required (i.e.
public  booleanexists(String remoteFile)
    
public  voidget(String localPath, String remoteFile)
     Get data from the FTP server.
public  voidget(OutputStream destStream, String remoteFile)
     Get data from the FTP server.
public  byte[]get(String remoteFile)
     Get data from the FTP server.
public  intgetDeleteCount()
    
public  booleangetDetectTransferMode()
    
public  intgetDownloadCount()
    
public  StringgetId()
    
public  longgetMonitorInterval()
    
public  StringgetRemoteHost()
     Returns the IP address or name of the remote host.
public  intgetRemotePort()
     Returns the port being connected to on the remote server.
public  intgetTimeout()
     Get the TCP timeout on the underlying socket(s).
public  FTPTransferTypegetType()
     Get the current transfer type the current type of the transfer,i.e.
public  intgetUploadCount()
    
public  voidkeepAlive()
     Tries to keep the current connection alive by some means, usually by sending an innocuous commmand.
public  voidmkdir(String dir)
    
public  Datemodtime(String remoteFile)
     Get modification time for a remote file.
public  Stringput(String localPath, String remoteFile)
     Put a local file onto the FTP server.
public  Stringput(InputStream srcStream, String remoteFile)
     Put a stream of data onto the FTP server.
public  Stringput(InputStream srcStream, String remoteFile, boolean append)
     Put a stream of data onto the FTP server.
public  Stringput(byte[] bytes, String remoteFile)
     Put data onto the FTP server.
public  Stringput(byte[] bytes, String remoteFile, boolean append)
     Put data onto the FTP server.
public  Stringput(String localPath, String remoteFile, boolean append)
     Put a local file onto the FTP server.
public  Stringpwd()
    
public  voidquit()
    
public  voidquitImmediately()
     Quit the FTP session immediately.
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  voidresetUploadCount()
     Reset the count of uploaded files to zero.
public  voidresume()
     Make the next file transfer (put or get) resume.
public  voidrmdir(String dir)
    
public  voidsetDetectTransferMode(boolean detectTransferMode)
     Set autodetect of filetypes on or off.
public  voidsetId(String id)
    
public  voidsetProgressMonitor(FTPProgressMonitor monitor, long interval)
     Set a progress monitor for callbacks.
public  voidsetProgressMonitor(FTPProgressMonitor monitor)
     Set a progress monitor for callbacks.
public  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  voidsetRemotePort(int remotePort)
     Set the port to connect to on the remote server.
public  voidsetTimeout(int millis)
     Set the TCP timeout on the underlying socket(s). Timeouts should be set before connections are made. If a timeout is set, then any operation which takes longer than the timeout value will be killed with a java.io.InterruptedException. The default is 0 meaning that the connection never times out.
public  voidsetType(FTPTransferType type)
    
public  longsize(String remoteFile)
     Get the size of a remote file.



Method Detail
cancelResume
public void cancelResume() throws IOException, FTPException(Code)
Cancel the resume. Use this method if something goes wrong and the server is left in an inconsistent state
throws:
  IOException -
throws:
  FTPException -



cancelTransfer
public void cancelTransfer()(Code)
Cancels the current transfer. Generally called from a separate thread. Note that this may leave partially written files on the server or on local disk, and should not be used unless absolutely necessary. After the transfer is cancelled the connection may be in an inconsistent state, therefore it is best to quit and reconnect. It may cause exceptions to be thrown depending on the underlying protocol being used. Note that this can also be used to cancel directory listings, which can involve large amounts of data for directories containing many files.



cdup
public void cdup() throws IOException, FTPException(Code)
Change the remote working directory to the parent directory



chdir
public void chdir(String dir) throws IOException, FTPException(Code)
Change the remote working directory to that supplied
Parameters:
  dir - name of remote directory tochange to



connect
public void connect() throws IOException, FTPException(Code)
Connects to the server at the address and port number defined in the constructor.
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 the client currently connected? true if connected, false otherwise



delete
public void delete(String remoteFile) throws IOException, FTPException(Code)
Delete the specified remote file
Parameters:
  remoteFile - name of remote file todelete



dir
public String[] dir() throws IOException, FTPException(Code)
List current directory's contents as an array of strings of filenames. an array of current directory listing strings



dir
public String[] dir(String dirname) throws IOException, FTPException(Code)
List a directory's contents as an array of strings of filenames.
Parameters:
  dirname - name of directory OR filemask an array of directory listing strings



dir
public String[] dir(String dirname, boolean full) throws IOException, FTPException(Code)
List a directory's contents as an array of strings. A detailed listing is available, otherwise just filenames are provided. The detailed listing varies in details depending on OS and FTP server. Note that a full listing can be used on a file name to obtain information about a file
Parameters:
  dirname - name of directory OR filemask
Parameters:
  full - true if detailed listing requiredfalse otherwise an array of directory listing strings



dirDetails
public FTPFile[] dirDetails(String dirname) throws IOException, FTPException, ParseException(Code)
List a directory's contents as an array of FTPFile objects. Should work for Windows and most Unix FTP servers - let us know about unusual formats (http://www.enterprisedt.com/forums/index.php). If accurate timestamps are required (i.e. to the second), it is generally better to use @see #modtime(String).
Parameters:
  dirname - name of directory (some servers permit a filemask) an array of FTPFile objects



exists
public boolean exists(String remoteFile) throws IOException, FTPException(Code)
Does the named file exist in the current server directory?
Parameters:
  remoteFile - name of remote file true if exists, false otherwise
throws:
  IOException -
throws:
  FTPException -



get
public void get(String localPath, String remoteFile) throws IOException, FTPException(Code)
Get data from the FTP server. Uses the currently set transfer mode.
Parameters:
  localPath - local file to put data in
Parameters:
  remoteFile - name of remote file incurrent directory



get
public void get(OutputStream destStream, String remoteFile) throws IOException, FTPException(Code)
Get data from the FTP server. Uses the currently set transfer mode.
Parameters:
  destStream - data stream to write data to
Parameters:
  remoteFile - name of remote file incurrent directory



get
public byte[] get(String remoteFile) throws IOException, FTPException(Code)
Get data from the FTP server. Transfers in whatever mode we are in. Retrieve as a byte array. Note that we may experience memory limitations as the entire file must be held in memory at one time.
Parameters:
  remoteFile - name of remote file incurrent directory



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



getDetectTransferMode
public boolean getDetectTransferMode()(Code)
Get the detect transfer mode true if we are detecting binary and ASCII transfers from the file type



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



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



getMonitorInterval
public long getMonitorInterval()(Code)
Get the bytes transferred between each callback on the progress monitor long bytes to be transferred before a callback



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



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



getTimeout
public int getTimeout()(Code)
Get the TCP timeout on the underlying socket(s). A value of 0 (the default) means that there are no timeouts. timeout that is used, in milliseconds



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



keepAlive
public void keepAlive() throws IOException, FTPException(Code)
Tries to keep the current connection alive by some means, usually by sending an innocuous commmand.



mkdir
public void mkdir(String dir) throws IOException, FTPException(Code)
Create the specified remote working directory
Parameters:
  dir - name of remote directory tocreate



modtime
public Date modtime(String remoteFile) throws IOException, FTPException(Code)
Get modification time for a remote file. For accurate modification times (e.g. to the second) this method is to be preferred over @see #dirDetails(java.lang.String) which parses a listing returned by the server. The timezone is GMT.
Parameters:
  remoteFile - name of remote file modification time of file as a date



put
public String put(String localPath, String remoteFile) throws IOException, FTPException(Code)
Put a local file onto the FTP server. It is placed in the current directory. If a remote file name is supplied, it is stored as that name on the server. If null is supplied, the server will generate a unique filename (via STOU) if it supports this option.
Parameters:
  localPath - path of the local file
Parameters:
  remoteFile - name of remote file incurrent directory, or null if a unique filename is to be generated by the server The name of the remote file - normally the name supplied, or elsethe unique name generated by the server.



put
public String put(InputStream srcStream, String remoteFile) throws IOException, FTPException(Code)
Put a stream of data onto the FTP server. It is placed in the current directory. If a remote file name is supplied, it is stored as that name on the server. If null is supplied, the server will generate a unique filename (via STOU) if it supports this option.
Parameters:
  srcStream - input stream of data to put
Parameters:
  remoteFile - name of remote file incurrent directory, or null if a unique filename is to be generated by the server The name of the remote file - normally the name supplied, or elsethe unique name generated by the server.



put
public String put(InputStream srcStream, String remoteFile, boolean append) throws IOException, FTPException(Code)
Put a stream of data onto the FTP server. It is placed in the current directory. If a remote file name is supplied, it is stored as that name on the server. If null is supplied, the server will generate a unique filename (via STOU) if it supports this option. Allows appending if current file exists.
Parameters:
  srcStream - input stream of data to put
Parameters:
  remoteFile - name of remote file incurrent directory, or null if a unique filename is to be generated by the server
Parameters:
  append - true if appending, false otherwise The name of the remote file - normally the name supplied, or elsethe unique name generated by the server.



put
public String put(byte[] bytes, String remoteFile) throws IOException, FTPException(Code)
Put data onto the FTP server. It is placed in the current directory. If a remote file name is supplied, it is stored as that name on the server. If null is supplied, the server will generate a unique filename (via STOU) if it supports this option.
Parameters:
  bytes - array of bytes
Parameters:
  remoteFile - name of remote file incurrent directory, or null if a unique filename is to be generated by the server The name of the remote file - normally the name supplied, or elsethe unique name generated by the server.



put
public String put(byte[] bytes, String remoteFile, boolean append) throws IOException, FTPException(Code)
Put data onto the FTP server. It is placed in the current directory. If a remote file name is supplied, it is stored as that name on the server. If null is supplied, the server will generate a unique filename (via STOU) if it supports this option. Allows appending if current file exists.
Parameters:
  bytes - array of bytes
Parameters:
  remoteFile - name of remote file incurrent directory, or null if a unique filename is to be generated by the server
Parameters:
  append - true if appending, false otherwise The name of the remote file - normally the name supplied, or elsethe unique name generated by the server.



put
public String put(String localPath, String remoteFile, boolean append) throws IOException, FTPException(Code)
Put a local file onto the FTP server. It is placed in the current directory. If a remote file name is supplied, it is stored as that name on the server. If null is supplied, the server will generate a unique filename (via STOU) if it supports this option. Allows appending if current file exists.
Parameters:
  localPath - path of the local file
Parameters:
  remoteFile - name of remote file in current directory, or null if a unique filename is to be generated by the server
Parameters:
  append - true if appending, false otherwise The name of the remote file - normally the name supplied, or elsethe unique name generated by the server.



pwd
public String pwd() throws IOException, FTPException(Code)
Get the current remote working directory the current working directory



quit
public void quit() throws IOException, FTPException(Code)
Quit the FTP session



quitImmediately
public void quitImmediately() throws IOException, FTPException(Code)
Quit the FTP session immediately. If a transfer is underway it will be terminated.



rename
public void rename(String from, String to) throws IOException, FTPException(Code)
Rename a file or directory
Parameters:
  from - name of file or directory to rename
Parameters:
  to - intended name



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.



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



resume
public void resume() throws FTPException(Code)
Make the next file transfer (put or get) resume. For puts(), the bytes already transferred are skipped over, while for gets(), if writing to a file, it is opened in append mode, and only the bytes required are transferred. Currently resume is only supported for BINARY transfers (which is generally what it is most useful for).
throws:
  FTPException -



rmdir
public void rmdir(String dir) throws IOException, FTPException(Code)
Delete the specified remote working directory
Parameters:
  dir - name of remote directory todelete



setDetectTransferMode
public void setDetectTransferMode(boolean detectTransferMode)(Code)
Set autodetect 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:
  detectTransferMode - true if detecting transfer mode, false if not



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



setProgressMonitor
public void setProgressMonitor(FTPProgressMonitor monitor, long interval)(Code)
Set a progress monitor for callbacks. The bytes transferred in between callbacks is only indicative. In many cases, the data is read in chunks, and if the interval is set to be smaller than the chunk size, the callback will occur after after chunk transfer rather than the interval. Depending on the implementation, the chunk size can be as large as 64K.
Parameters:
  monitor - the monitor object
Parameters:
  interval - bytes transferred in between callbacks



setProgressMonitor
public void setProgressMonitor(FTPProgressMonitor monitor)(Code)
Set a progress monitor for callbacks. Uses default callback interval
Parameters:
  monitor - the monitor object



setRemoteHost
public void setRemoteHost(String remoteHost) throws IOException, 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 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 void setTimeout(int millis) throws IOException, FTPException(Code)
Set the TCP timeout on the underlying socket(s). Timeouts should be set before connections are made. If a timeout is set, then any operation which takes longer than the timeout value will be killed with a java.io.InterruptedException. The default is 0 meaning that the connection never times out.
Parameters:
  millis - The length of the timeout, in milliseconds



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



size
public long size(String remoteFile) throws IOException, FTPException(Code)
Get the size of a remote file. This is not a standard FTP command, it is defined in "Extensions to FTP", a draft RFC (draft-ietf-ftpext-mlst-16.txt)
Parameters:
  remoteFile - name or path of remote file in current directory size of file in bytes



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