Java Doc for FTPClient.java in  » Groupware » hipergate » 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 » Groupware » hipergate » 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 (Code)
Supports client-side FTP. Most common FTP operations are present in this class.
author:
   Bruce Blackshaw
version:
   $Revision: 1.1.1.1 $



Constructor Summary
public  FTPClient(String remoteHost)
     Constructor.
public  FTPClient(String remoteHost, int controlPort)
     Constructor.
public  FTPClient(InetAddress remoteAddr)
     Constructor.
public  FTPClient(InetAddress remoteAddr, int controlPort)
     Constructor.
public  FTPClient(String remoteHost, PrintWriter log, int timeout)
     Constructor.
public  FTPClient(String remoteHost, int controlPort, PrintWriter log, int timeout)
     Constructor.
public  FTPClient(InetAddress remoteAddr, PrintWriter log, int timeout)
     Constructor.
public  FTPClient(InetAddress remoteAddr, int controlPort, PrintWriter log, int timeout)
     Constructor.

Method Summary
public  voidchdir(String dir)
    
public  voiddebugResponses(boolean on)
    
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  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  FTPReplygetLastValidReply()
    
 StringgetRemoteHostName()
    
public  FTPTransferTypegetType()
     Get the current transfer type the current type of the transfer,i.e.
public  Stringhelp(String command)
    
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.
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  voidmkdir(String dir)
    
public  Datemodtime(String remoteFile)
    
public  voidpassword(String password)
     Supplies the password for a previously supplied username to log into the FTP server.
public  voidput(String localPath, String remoteFile)
     Put a local file onto the FTP server.
public  voidput(InputStream srcStream, String remoteFile)
     Put a stream of data onto the FTP server.
public  voidput(String localPath, String remoteFile, boolean append)
     Put a local file onto the FTP server.
public  voidput(InputStream srcStream, String remoteFile, boolean append)
     Put a stream of data onto the FTP server.
public  voidput(byte[] bytes, String remoteFile)
     Put data onto the FTP server.
public  voidput(byte[] bytes, String remoteFile, boolean append)
     Put data onto the FTP server.
public  Stringpwd()
    
public  voidquit()
    
public  voidquote(String command, String[] validCodes)
     Issue arbitrary ftp commands to the FTP server.
public  voidrename(String from, String to)
    
public  voidrmdir(String dir)
    
public  voidsetConnectMode(FTPConnectMode mode)
    
public  voidsetLogStream(PrintWriter log)
    
public  voidsetTimeout(int millis)
     Set the TCP timeout on the underlying socket. If a timeout is set, then any operation which takes longer than the timeout value will be killed with a java.io.InterruptedException.
public  voidsetType(FTPTransferType type)
    
public  booleansite(String command)
     Run a site-specific command on the server.
public  Stringsystem()
    
public  voiduser(String user)
     Supply the user name to log into an account on the FTP server.


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



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(String remoteHost, PrintWriter log, int timeout) throws IOException, FTPException(Code)
Constructor. Creates the control socket
Parameters:
  remoteHost - the remote hostname
Parameters:
  millis - the length of the timeout, in milliseconds



FTPClient
public FTPClient(String remoteHost, int controlPort, PrintWriter log, int timeout) throws IOException, FTPException(Code)
Constructor. Creates the control socket
Parameters:
  remoteHost - the remote hostname
Parameters:
  controlPort - port for control stream
Parameters:
  millis - the length of the timeout, in milliseconds



FTPClient
public FTPClient(InetAddress remoteAddr, PrintWriter log, int timeout) throws IOException, FTPException(Code)
Constructor. Creates the control socket
Parameters:
  remoteAddr - the address of theremote host
Parameters:
  millis - the length of the timeout, in milliseconds



FTPClient
public FTPClient(InetAddress remoteAddr, int controlPort, PrintWriter log, 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
Parameters:
  millis - the length of the timeout, in milliseconds




Method Detail
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



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)
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(not a file mask) 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 (not a file mask)
Parameters:
  full - true if detailed listing requiredfalse otherwise an array of directory listing strings



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



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



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



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



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



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



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
Parameters:
  user - user name
Parameters:
  password - user's password



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
Parameters:
  remoteFile - name of remote file modification time of file as a date



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:
  user - user name
Parameters:
  password - user's password



put
public void put(String localPath, String remoteFile) throws IOException, FTPException(Code)
Put a local file onto the FTP server. It is placed in the current directory.
Parameters:
  localPath - path of the local file
Parameters:
  remoteFile - name of remote file incurrent directory



put
public void 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.
Parameters:
  srcStream - input stream of data to put
Parameters:
  remoteFile - name of remote file incurrent directory



put
public void 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. Allows appending if current file exists
Parameters:
  localPath - path of the local file
Parameters:
  remoteFile - name of remote file incurrent directory
Parameters:
  append - true if appending, false otherwise



put
public void 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. Allows appending if current file exists
Parameters:
  srcStream - input stream of data to put
Parameters:
  remoteFile - name of remote file incurrent directory
Parameters:
  append - true if appending, false otherwise



put
public void put(byte[] bytes, String remoteFile) throws IOException, FTPException(Code)
Put data onto the FTP server. It is placed in the current directory.
Parameters:
  data - array of bytes
Parameters:
  remoteFile - name of remote file incurrent directory



put
public void put(byte[] bytes, String remoteFile, boolean append) throws IOException, FTPException(Code)
Put data onto the FTP server. It is placed in the current directory. Allows appending if current file exists
Parameters:
  data - array of bytes
Parameters:
  remoteFile - name of remote file incurrent directory
Parameters:
  append - true if appending, false otherwise



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



quote
public void 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



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



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



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



setLogStream
public void setLogStream(PrintWriter log)(Code)
Set the logging stream, replacing stdout
Parameters:
  log - the new logging stream



setTimeout
public void setTimeout(int millis) throws IOException(Code)
Set the TCP timeout on the underlying socket. If a timeout is set, then any operation which takes longer than the timeout value will be killed with a java.io.InterruptedException. We set both the control and data connections
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



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



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



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
Parameters:
  user - user name
Parameters:
  password - user's password



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.