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

FTPControlSocket
public class FTPControlSocket (Code)
Supports client-side FTP operations
author:
   Bruce Blackshaw
version:
   $Revision: 1.40 $


Field Summary
final public static  intCONTROL_PORT
    
final static  StringEOL
    
protected  booleanautoPassiveIPSubstitution
    
protected  SocketcontrolSock
     The underlying socket.
final public static  StringcvsId
    
protected  StringforcedActiveIP
    
protected  booleanlistenOnAllInterfaces
    
protected  BufferedReaderreader
    
protected  InetAddressremoteAddr
    
protected  Writerwriter
    

Constructor Summary
protected  FTPControlSocket(InetAddress remoteAddr, int controlPort, int timeout, String encoding, FTPMessageListener messageListener)
     Constructor.
protected  FTPControlSocket(InetAddress remoteAddr, Socket controlSock, int timeout, String encoding, FTPMessageListener messageListener)
     Constructs a new FTPControlSocket using the given Socket object.
Parameters:
  remoteAddr - the remote address
Parameters:
  controlSock - Socket to be used.

Method Summary
public  voidclose()
    
 FTPDataSocketcreateDataSocket(FTPConnectMode connectMode)
     Request a data socket be created on the server, connect to it and return our connected socket.
 FTPDataSocketcreateDataSocketActive()
     Request a data socket be created on the Client client on any free port, do not connect it to yet.
protected  FTPDataSocketcreateDataSocketPASV()
     Request a data socket be created on the server, connect to it and return our connected socket.
 booleangetListenOnAllInterfaces()
    
 int[]getPASVParts(String reply)
    
 StringgetRemoteHostName()
    
protected  voidinitStreams()
     Initialize the reader/writer streams for this connection.
 voidlog(String msg, boolean command)
    
public  voidlogout()
     Quit this FTP session and clean up.
protected  FTPDataSocketnewActiveDataSocket(int port)
     Constructs a new FTPDataSocket object (server mode) which will listen on the given port number.
Parameters:
  port - Remote port to listen on.
protected  FTPDataSocketnewPassiveDataSocket(String remoteHost, int port)
     Constructs a new FTPDataSocket object (client mode) and connect to the given remote host and port number.
Parameters:
  remoteHost - Remote host to connect to.
Parameters:
  port - Remote port to connect to.
 FTPReplyreadReply()
     Read the FTP server's reply to a previously issued command.
public  FTPReplysendCommand(String command)
    
 voidsendPORTCommand(short port)
    
 voidsetActivePortIPAddress(String forcedActiveIP)
     We can force PORT to send a fixed IP address, which can be useful with certain NAT configurations.
public  voidsetActivePortRange(int lowest, int highest)
    
protected  voidsetAutoPassiveIPSubstitution(boolean autoPassiveIPSubstitution)
    
protected  voidsetDataPort(InetAddress host, short portNo)
     Sets the data port on the server, that is, sends a PORT command.
 voidsetListenOnAllInterfaces(boolean listenOnAll)
     Listen on all interfaces for active mode transfers (the default).
 voidsetMessageListener(FTPMessageListener listener)
    
 voidsetStrictReturnCodes(boolean strict)
     Set strict checking of FTP return codes.
 voidsetTimeout(int millis)
     Set the TCP timeout on the underlying control socket.
protected  byte[]toByteArray(short value)
    
 FTPReplyvalidateReply(String reply, String expectedReplyCode)
     Validate the response the host has supplied against the expected reply.
public  FTPReplyvalidateReply(String reply, String[] expectedReplyCodes)
     Validate the response the host has supplied against the expected reply.
public  FTPReplyvalidateReply(FTPReply reply, String[] expectedReplyCodes)
     Validate the response the host has supplied against the expected reply.
public  FTPReplyvalidateReply(FTPReply reply, String expectedReplyCode)
     Validate the response the host has supplied against the expected reply.
 voidwriteCommand(String command)
     Send a command to the FTP server.

Field Detail
CONTROL_PORT
final public static int CONTROL_PORT(Code)
The default and standard control port number for FTP



EOL
final static String EOL(Code)
Standard FTP end of line sequence



autoPassiveIPSubstitution
protected boolean autoPassiveIPSubstitution(Code)
If true, uses the original host IP if an internal IP address is returned by the server in PASV mode



controlSock
protected Socket controlSock(Code)
The underlying socket.



cvsId
final public static String cvsId(Code)
Revision control id



forcedActiveIP
protected String forcedActiveIP(Code)
IP address we force PORT to send - useful with certain NAT configurations



listenOnAllInterfaces
protected boolean listenOnAllInterfaces(Code)
Listen to all interfaces in active mode



reader
protected BufferedReader reader(Code)
The reader that reads control data from the control socket



remoteAddr
protected InetAddress remoteAddr(Code)
The remote address to connect to



writer
protected Writer writer(Code)
The write that writes to the control socket




Constructor Detail
FTPControlSocket
protected FTPControlSocket(InetAddress remoteAddr, int controlPort, int timeout, String encoding, FTPMessageListener messageListener) throws IOException, FTPException(Code)
Constructor. Performs TCP connection and sets up reader/writer. Allows different control port to be used
Parameters:
  remoteAddr - Remote inet address
Parameters:
  controlPort - port for control stream
Parameters:
  timeout - the length of the timeout, in milliseconds
Parameters:
  encoding - character encoding used for data
Parameters:
  messageListener - listens for messages



FTPControlSocket
protected FTPControlSocket(InetAddress remoteAddr, Socket controlSock, int timeout, String encoding, FTPMessageListener messageListener) throws IOException, FTPException(Code)
Constructs a new FTPControlSocket using the given Socket object.
Parameters:
  remoteAddr - the remote address
Parameters:
  controlSock - Socket to be used.
Parameters:
  timeout - Timeout to be used.
Parameters:
  encoding - character encoding used for data
Parameters:
  messageListener - listens for messages
throws:
  IOException - Thrown if no connection response could be read from the server.
throws:
  FTPException - Thrown if the incorrect connection response was sent by the server.




Method Detail
close
public void close() throws IOException(Code)
Close the socket
throws:
  IOException -



createDataSocket
FTPDataSocket createDataSocket(FTPConnectMode connectMode) throws IOException, FTPException(Code)
Request a data socket be created on the server, connect to it and return our connected socket.
Parameters:
  active - if true, create in active mode, elsein passive mode connected data socket



createDataSocketActive
FTPDataSocket createDataSocketActive() throws IOException, FTPException(Code)
Request a data socket be created on the Client client on any free port, do not connect it to yet. not connected data socket



createDataSocketPASV
protected FTPDataSocket createDataSocketPASV() throws IOException, FTPException(Code)
Request a data socket be created on the server, connect to it and return our connected socket. connected data socket



getListenOnAllInterfaces
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



getPASVParts
int[] getPASVParts(String reply) throws FTPException(Code)
Get the parts that make up the PASV reply
Parameters:
  reply - reply string
throws:
  FTPException -



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



initStreams
protected void initStreams() throws IOException(Code)
Initialize the reader/writer streams for this connection.



log
void log(String msg, boolean command)(Code)
Log a message, checking for passwords
Parameters:
  msg - message to log
Parameters:
  reply - true if a response, false otherwise



logout
public void logout() throws IOException(Code)
Quit this FTP session and clean up.



newActiveDataSocket
protected FTPDataSocket newActiveDataSocket(int port) throws IOException(Code)
Constructs a new FTPDataSocket object (server mode) which will listen on the given port number.
Parameters:
  port - Remote port to listen on. A new FTPDataSocket object (server mode) which isconfigured to listen on the given port.
throws:
  IOException - Thrown if an error occurred when creating the socket.



newPassiveDataSocket
protected FTPDataSocket newPassiveDataSocket(String remoteHost, int port) throws IOException(Code)
Constructs a new FTPDataSocket object (client mode) and connect to the given remote host and port number.
Parameters:
  remoteHost - Remote host to connect to.
Parameters:
  port - Remote port to connect to. A new FTPDataSocket object (client mode) which isconnected to the given server.
throws:
  IOException - Thrown if no TCP/IP connection could be made.



readReply
FTPReply readReply() throws IOException(Code)
Read the FTP server's reply to a previously issued command. RFC 959 states that a reply consists of the 3 digit code followed by text. The 3 digit code is followed by a hyphen if it is a multiline response, and the last line starts with the same 3 digit code. structured reply object



sendCommand
public FTPReply sendCommand(String command) throws IOException(Code)
Send a command to the FTP server and return the server's reply as a structured reply object
Parameters:
  command - command to send reply to the supplied command



sendPORTCommand
void sendPORTCommand(short port) throws IOException, FTPException(Code)
Send the PORT command to the server
Parameters:
  socket - data socket
throws:
  IOException -
throws:
  FTPException -



setActivePortIPAddress
void setActivePortIPAddress(String forcedActiveIP)(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:
  forcedActiveIP - IP address to force



setActivePortRange
public void setActivePortRange(int lowest, int highest)(Code)
Set the port number range for active mode
Parameters:
  lowest - lowest port number in range
Parameters:
  highest - highest port number in range



setAutoPassiveIPSubstitution
protected 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



setDataPort
protected void setDataPort(InetAddress host, short portNo) throws IOException, FTPException(Code)
Sets the data port on the server, that is, sends a PORT command.
Parameters:
  host - the local host the server will connect to
Parameters:
  portNo - the port number to connect to



setListenOnAllInterfaces
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
void setMessageListener(FTPMessageListener listener)(Code)
Set a listener that handles all FTP messages
Parameters:
  listener - message listener



setStrictReturnCodes
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
void setTimeout(int millis) throws IOException(Code)
Set the TCP timeout on the underlying control socket. If a timeout is set, then any operation which takes longer than the timeout value will be killed with a java.io.InterruptedException.
Parameters:
  millis - The length of the timeout, in milliseconds



toByteArray
protected byte[] toByteArray(short value)(Code)
Convert a short into a byte array
Parameters:
  value - value to convert a byte array



validateReply
FTPReply validateReply(String reply, String expectedReplyCode) throws FTPException(Code)
Validate the response the host has supplied against the expected reply. If we get an unexpected reply we throw an exception, setting the message to that returned by the FTP server
Parameters:
  reply - the entire reply string we received
Parameters:
  expectedReplyCode - the reply we expected to receive



validateReply
public FTPReply validateReply(String reply, String[] expectedReplyCodes) throws IOException, FTPException(Code)
Validate the response the host has supplied against the expected reply. If we get an unexpected reply we throw an exception, setting the message to that returned by the FTP server
Parameters:
  reply - the entire reply string we received
Parameters:
  expectedReplyCodes - array of expected replies an object encapsulating the server's reply



validateReply
public FTPReply validateReply(FTPReply reply, String[] expectedReplyCodes) throws FTPException(Code)
Validate the response the host has supplied against the expected reply. If we get an unexpected reply we throw an exception, setting the message to that returned by the FTP server
Parameters:
  reply - reply object
Parameters:
  expectedReplyCodes - array of expected replies reply object



validateReply
public FTPReply validateReply(FTPReply reply, String expectedReplyCode) throws FTPException(Code)
Validate the response the host has supplied against the expected reply. If we get an unexpected reply we throw an exception, setting the message to that returned by the FTP server
Parameters:
  reply - reply object
Parameters:
  expectedReplyCode - expected reply reply object



writeCommand
void writeCommand(String command) throws IOException(Code)
Send a command to the FTP server. Don't read the reply
Parameters:
  command - command to send



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.