de.unkrig.commons.net.ftp
Class FtpClient

java.lang.Object
  extended by de.unkrig.commons.net.ftp.FtpClient

public class FtpClient
extends java.lang.Object

An FTP client.


Constructor Summary
FtpClient(java.io.InputStream controlIn, java.io.OutputStream controlOut, java.net.InetAddress controlLocalAddress)
           
 
Method Summary
 void active(int port)
           
 void changeWorkingDirectory(java.lang.String directory)
          Changes the remote working directory.
 void dispose()
          Releases all resources associated with the connection to the FTP server, specifically an open data connection.
 void login(java.lang.String user, java.lang.String password)
          Logs in to the remote FTP server.
 void passive()
          Switches fro ACTIVE to PASSIVE mode.
 java.io.InputStream retrieve(java.lang.String fileName)
          The caller is responsible for closing the returned InputStream.
 void setDataConnectionAcceptTimeout(int dataConnectionAcceptTimeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FtpClient

public FtpClient(java.io.InputStream controlIn,
                 java.io.OutputStream controlOut,
                 java.net.InetAddress controlLocalAddress)
          throws java.io.IOException
Throws:
java.io.IOException
Method Detail

setDataConnectionAcceptTimeout

public void setDataConnectionAcceptTimeout(int dataConnectionAcceptTimeout)
See Also:
ServerSocket.setSoTimeout(int)

login

public void login(java.lang.String user,
                  java.lang.String password)
           throws java.io.IOException
Logs in to the remote FTP server.

Throws:
java.io.IOException

changeWorkingDirectory

public void changeWorkingDirectory(java.lang.String directory)
                            throws java.io.IOException
Changes the remote working directory.

Throws:
java.io.IOException

passive

public void passive()
             throws java.io.IOException
Switches fro ACTIVE to PASSIVE mode.

Throws:
java.io.IOException

active

public void active(int port)
            throws java.io.IOException
Parameters:
port - Pass 0 to pick an ephemeral port.
Throws:
java.io.IOException

retrieve

public java.io.InputStream retrieve(java.lang.String fileName)
                             throws java.io.IOException
The caller is responsible for closing the returned InputStream.

Throws:
java.io.IOException

dispose

public void dispose()
Releases all resources associated with the connection to the FTP server, specifically an open data connection.