zoukankan      html  css  js  c++  java
  • org.apache.commons.net.ftp

    org.apache.commons.NET.ftp
    Class FTPClient类FTPClient

    java.lang.Object Java.lang.Object继承

       org.apache.commons.net.SocketClient org.apache.commons.net.SocketClient

           org.apache.commons.net.ftp.FTP org.apache.commons.Net.ftp.FTP

               org.apache.commons.net.ftp.FTPClient org.apache.commons.net.ftp.FTPClient

    All Implemented Interfaces:所有已实现的接口:

    Configurable 可配置

    Direct Known Subclasses:直接已知子类:

    FTPHTTPClient , FTPSClient FTPHTTPClient FTPSClient


     public class FTPClient公共类FTPClient

     extends FTP延伸的FTP

     implements Configurable实现了可配置

    FTPClient encapsulates all the functionality necessary to store and retrieve files from an FTP server. FTPClient封装了所有必要的功能来存储和检索从FTP服务器上的文件。 This class takes care of all low level details of interacting with an FTP server and provides a convenient higher level interface.这个类负责所有与FTP服务器交互的底层细节,并提供了便捷的更高层次的接口。 As with all classes derived from SocketClient , you must first connect to the server with connect before doing anything, and finally disconnect after you're completely finished interacting with the server.正如来自所有类SocketClient ,您必须首先连接到与服务器connect做任何事之前,最后disconnect完成后,你完全与服务器交互。 Then you need to check the FTP reply code to see if the connection was successful.然后,你需要检查的FTP答复代码,看看是否连接成功。 For example:例如:

        boolean error = false;布尔错误= 0;

        try {尝试{

          int reply;诠释答复;

          ftp.connect("ftp.foobar.com"); ftp.connect(“ftp.foobar.com”);

          System.out.println("Connected to " + server + "."); System.out.println(“连接到”+服务器+ ".");

          System.out.print(ftp.getReplyString()); System.out.print(ftp.getReplyString());

     

          // After connection attempt, you should check the reply code to verify / /连接尝试后,你应该检查代码以验证答复

          // success. / /成功。

          reply = ftp.getReplyCode();答复= ftp.getReplyCode();

     

          if(!FTPReply.isPositiveCompletion(reply)) {如果(!FTPReply.isPositiveCompletion(回复)){

            ftp.disconnect(); ftp.disconnect();

            System.err.println("FTP server refused connection."); System.err.println(“FTP服务器拒绝连接。”);

            System.exit(1); System.exit(1);

          } }

          ... ... // transfer files / /传送文件

          ftp.logout(); ftp.logout();

        } catch(IOException e) { }捕捉(IOException异常五){

          error = true;误差为真;

          e.printStackTrace(); e.printStackTrace();

        } finally {最后} {

          if(ftp.isConnected()) {如果(ftp.isConnected()){

            try {尝试{

              ftp.disconnect(); ftp.disconnect();

            } catch(IOException ioe) { }捕捉(IOException异常雇主组织){

              // do nothing / /什么也不做

            } }

          } }

          System.exit(error ? 1 : 0); System.exit(错误1:0?);

        } }

     

    Immediately after connecting is the only real time you need to check the reply code (because connect is of type void).连接后立即是唯一真正的时候你需要检查答复代码(因为是连接类型为void)。 The convention for all the FTP command methods in FTPClient is such that they either return a boolean value or some other value.对于所有的FTP FTPClient指挥方法的公约就是这样,他们要么返回一个布尔值或其他值。 The boolean methods return true on a successful completion reply from the FTP server and false on a reply resulting in an error condition or failure.该方法返回一个布尔从FTP服务器成功完成答辩,假假真真的错误条件中的一个或故障而导致的答复。 The methods returning a value other than boolean return a value containing the higher level data produced by the FTP command, or null if a reply resulted in an error condition or failure.该方法返回一个布尔值返回值比含有较高水平的FTP命令,或者为null,如果产生一个错误条件答复或故障导致其他数据。 If you want to access the exact FTP reply code causing a success or failure, you must call getReplyCode after a success or failure.如果您要访问的FTP的确切答复代码导致成功或失败,你必须调用getReplyCode后,成功或失败。

    The default settings for FTPClient are for it to use FTP.ASCII_FILE_TYPE , FTP.NON_PRINT_TEXT_FORMAT , FTP.STREAM_TRANSFER_MODE , and FTP.FILE_STRUCTURE . FTPClient的默认设置是它使用FTP.ASCII_FILE_TYPE , FTP.NON_PRINT_TEXT_FORMAT , FTP.STREAM_TRANSFER_MODE和FTP.FILE_STRUCTURE 。 The only file types directly supported are FTP.ASCII_FILE_TYPE and FTP.BINARY_FILE_TYPE .唯一的文件直接支持的类型是FTP.ASCII_FILE_TYPE和FTP.BINARY_FILE_TYPE 。 Because there are at least 4 different EBCDIC encodings, we have opted not to provide direct support for EBCDIC.因为至少有4种不同的EBCDIC编码,我们还选择了不提供直接支持的EBCDIC。 To transfer EBCDIC and other unsupported file types you must create your own filter InputStreams and OutputStreams and wrap them around the streams returned or required by the FTPClient methods.为了转移EBCDIC和其他不支持的文件类型,你必须创建自己的过滤InputStreams和OutputStreams和总结他们周围的流退回或由FTPClient方法所需。 FTPClient uses the NetASCII filter streams to provide transparent handling of ASCII files. FTPClient使用NetASCII过滤器流提供ASCII文件透明处理。 We will consider incorporating EBCDIC support if there is enough demand.我们会考虑把EBCDIC码的支持,如果有足够的需求。

    FTP.NON_PRINT_TEXT_FORMAT , FTP.STREAM_TRANSFER_MODE , and FTP.FILE_STRUCTURE are the only supported formats, transfer modes, and file structures. FTP.NON_PRINT_TEXT_FORMAT , FTP.STREAM_TRANSFER_MODE和FTP.FILE_STRUCTURE是唯一支持的格式,传输模式和文件结构。

    Because the handling of sockets on different platforms can differ significantly, the FTPClient automatically issues a new PORT (or EPRT) command prior to every transfer requiring that the server connect to the client's data port.由于在不同平台上插座处理可以显着差异,在FTPClient自动发出一个新的端口(或EPRT)命令之前,每次传输要求的服务器连接到客户端的数据端口。 This ensures identical problem-free behavior on Windows, Unix, and Macintosh platforms.这将确保相同的Windows,Unix和Macintosh平台无故障的行为。 Additionally, it relieves programmers from having to issue the PORT (or EPRT) command themselves and dealing with platform dependent issues.此外,它解除不必发出端口(或EPRT)命令自己和与平台有关问题的程序员。

    Additionally, for security purposes, all data connections to the client are verified to ensure that they originated from the intended party (host and port).此外,为了安全起见,所有的数据连接到客户端进行验证,以确保他们打算从党(主机和端口)起源。 If a data connection is initiated by an unexpected party, the command will close the socket and throw an IOException.如果一个数据连接是由党发起的一个意外,该命令将关闭套接字并抛出一个IOException异常。 You may disable this behavior with setRemoteVerificationEnabled() .您可以禁用此行为setRemoteVerificationEnabled()

    You should keep in mind that the FTP server may choose to prematurely close a connection if the client has been idle for longer than a given time period (usually 900 seconds).你应该记住,在FTP服务器可以选择过早关闭连接,如果客户已超过给定的时间较长时期(通常为900秒)闲置。 The FTPClient class will detect a premature FTP server connection closing when it receives a FTPReply.SERVICE_NOT_AVAILABLE response to a command.将检测的FTPClient类FTP服务器连接过早关闭,当它收到FTPReply.SERVICE_NOT_AVAILABLE响应命令。 When that occurs, the FTP class method encountering that reply will throw an FTPConnectionClosedException . FTPConnectionClosedException is a subclass of IOException and therefore need not be caught separately, but if you are going to catch it separately, its catch block must appear before the more general IOException catch block.一旦这种情况发生时,FTP类方法遇到的答复将抛出一个FTPConnectionClosedException 。 FTPConnectionClosedException是一个子类IOException ,因此不必分别被捕获,但如果你要抓住它分开,它的catch块必须出现在更一般的IOException catch块。 When you encounter an FTPConnectionClosedException , you must disconnect the connection with disconnect() to properly clean up the system resources used by FTPClient.当你遇到一个FTPConnectionClosedException ,必须断开与连接disconnect()妥善清理,系统资源使用FTPClient。 Before disconnecting, you may check the last reply code and text with getReplyCode , getReplyString , and getReplyStrings .在断开,你可以检查代码和文本的最后答复与getReplyCode getReplyStringgetReplyStrings 。 You may avoid server disconnections while the client is idle by periodically sending NOOP commands to the server.您可能会避免服务器断开,而客户端闲置的空操作指令通过定期发送到服务器。

    Rather than list it separately for each method, we mention here that every method communicating with the server and throwing an IOException can also throw a MalformedServerReplyException , which is a subclass of IOException.它不是单独列出每个方法,我们在这里提到的每个方法与服务器通信,并抛出一个IOException异常也可引发MalformedServerReplyException ,这是一个IOException异常子类。 A MalformedServerReplyException will be thrown when the reply received from the server deviates enough from the protocol specification that it cannot be interpreted in a useful manner despite attempts to be as lenient as possible.将抛出一个MalformedServerReplyException答复时,从服务器收到的偏离足够的协议规范,它不能在一个有用的方式解释尽管试图尽可能宽松。

    Listing API Examples Both paged and unpaged examples of directory listings are available, as follows:上市API的两个例子的目录列表分页和无页数的范例,如下:

    Unpaged (whole list) access, using a parser accessible by auto-detect:无页数(全名单)访问,使用分析器可经自动检测:

        FTPClient f = new FTPClient(); FTPClient f =new FTPClient();

        f.connect(server); f.connect(服务器);

        f.login(username, password); f.login(用户名,密码);

        FTPFile[] files = listFiles(directory); FTPFile []文件= listfiles <套件(目录);

     

    Paged access, using a parser not accessible by auto-detect.分页访问,使用分析器无法访问的自动检测。 The class defined in the first parameter of initateListParsing should be derived from org.apache.commons.net.FTPFileEntryParser:在应该从org.apache.commons.net.FTPFileEntryParser派生initateListParsing第一个参数定义的类:

        FTPClient f = new FTPClient(); FTPClient f =new FTPClient();

        f.connect(server); f.connect(服务器);

        f.login(username, password); f.login(用户名,密码);

        FTPListParseEngine engine = FTPListParseEngine引擎=

           f.initiateListParsing("com.whatever.YourOwnParser", directory); f.initiateListParsing(“com.whatever.YourOwnParser”,目录);

     

        while (engine.hasNext()) {而(engine.hasNext()){

           FTPFile[] files = engine.getNext(25); // "page size" you want FTPFile []文件= engine.getNext(25); / /“页面大小”你想要

           //do whatever you want with these files, display them, etc. / /做你想做这些文件,显示它们,等

           //expensive FTPFile objects not created until needed. / /昂贵FTPFile不创建对象,直到需要。

        } }

     

    Paged access, using a parser accessible by auto-detect:分页访问,使用分析器可经自动检测:

        FTPClient f = new FTPClient(); FTPClient f =new FTPClient();

        f.connect(server); f.connect(服务器);

        f.login(username, password); f.login(用户名,密码);

        FTPListParseEngine engine = f.initiateListParsing(directory); FTPListParseEngine engine = f.initiateListParsing(目录);

     

        while (engine.hasNext()) {而(engine.hasNext()){

           FTPFile[] files = engine.getNext(25); // "page size" you want FTPFile []文件= engine.getNext(25); / /“页面大小”你想要

           //do whatever you want with these files, display them, etc. / /做你想做这些文件,显示它们,等

           //expensive FTPFile objects not created until needed. / /昂贵FTPFile不创建对象,直到需要。

        } }

     

    For examples of using FTPClient on servers whose directory listings有关使用服务器上的目录清单FTPClient例子

    • use languages other than English使用英语以外的语言
    • use date formats other than the American English "standard" MM d yyyy使用日期格式“以外的美国英语”标准MM d yyyy
    • are in different timezones and you need accurate timestamps for dependency checking as in Ant在不同的时区,你需要在蚁群依赖检查准确的时间戳

    see FTPClientConfig .FTPClientConfig

    Author:作者:

    Daniel F. Savarese, Rory Winston丹尼尔楼Savarese,罗里温斯顿

    See Also:另见:

    FTP , FTPConnectionClosedException , FTPFileEntryParser , FTPFileEntryParserFactory , DefaultFTPFileEntryParserFactory , FTPClientConfig , MalformedServerReplyException FTP FTPConnectionClosedException FTPFileEntryParser FTPFileEntryParserFactory DefaultFTPFileEntryParserFactory FTPClientConfig MalformedServerReplyException


    Field Summary字段摘要

    static int

    ACTIVE_LOCAL_DATA_CONNECTION_MODE
    A constant indicating the FTP session is expecting all transfers to occur between the client (local) and server and that the server should connect to the client's data port to initiate a data transfer.一个常量指示期待的FTP会话之间发生的所有传输客户端(本地)和服务器,该服务器应该连接到客户端的数据端口来启动数据传输。

    static int

    ACTIVE_REMOTE_DATA_CONNECTION_MODE
    A constant indicating the FTP session is expecting all transfers to occur between two remote servers and that the server the client is connected to should connect to the other server's data port to initiate a data transfer.一个常量指示期待的FTP会话的所有转让发生在两个远程服务器,而客户端连接到要连接到其他服务器的数据端口发起数据传输服务器。

    static int

    PASSIVE_LOCAL_DATA_CONNECTION_MODE
    A constant indicating the FTP session is expecting all transfers to occur between the client (local) and server and that the server is in passive mode, requiring the client to connect to the server's data port to initiate a transfer.一个常量指示期待的FTP会话之间发生的所有传输客户端(本地)和服务器,服务器在被动模式时,要求客户端连接到服务器的数据端口来启动传输。

    static int

    PASSIVE_REMOTE_DATA_CONNECTION_MODE
    A constant indicating the FTP session is expecting all transfers to occur between two remote servers and that the server the client is connected to is in passive mode, requiring the other server to connect to the first server's data port to initiate a data transfer.一个常量指示期待的FTP会话的所有转让发生在两个远程服务器,而客户端连接到处于被动模式,要求其他服务器连接到第一个服务器的数据端口发起数据传输服务器。

     

    Fields inherited from class org.apache.commons.net.ftp. FTP org.apache.commons.net.ftp类从继承的字段。 的FTP

    _commandSupport_ , _controlEncoding , _controlInput_ , _controlOutput_ , _newReplyString , _replyCode , _replyLines , _replyString , ASCII_FILE_TYPE , BINARY_FILE_TYPE , BLOCK_TRANSFER_MODE , CARRIAGE_CONTROL_TEXT_FORMAT , COMPRESSED_TRANSFER_MODE , DEFAULT_CONTROL_ENCODING , DEFAULT_DATA_PORT , DEFAULT_PORT , EBCDIC_FILE_TYPE , FILE_STRUCTURE , LOCAL_FILE_TYPE , NON_PRINT_TEXT_FORMAT , PAGE_STRUCTURE , RECORD_STRUCTURE , STREAM_TRANSFER_MODE , strictMultilineParsing , TELNET_TEXT_FORMAT

     

    Fields inherited from class org.apache.commons.net. SocketClient org.apache.commons.net类从继承的字段。 SocketClient

    _defaultPort_ , _input_ , _output_ , _serverSocketFactory_ , _socket_ , _socketFactory_ , _timeout_ , connectTimeout , NETASCII_EOL

     

    Constructor Summary构造方法摘要

    FTPClient ()
    Default FTPClient constructor.默认FTPClient构造。

     

     

    Method Summary方法摘要

    protected void

    _connectAction_ ()
    Initiates control connections and gets initial reply.启动控制连接,并得到初步答复。

    protected Socket

    _openDataConnection_ (int command, String arg)
    Establishes a data connection with the FTP server, returning a Socket for the connection if successful.建立一个与FTP服务器的数据连接,如果返回的成功连接的Socket。

    boolean

    abort ()
    Abort a transfer in progress.中止正在进行的传输。

    boolean

    allocate (int bytes)
    Reserve a number of bytes on the server for the next file transfer.保留一字节的下一个文件传输服务器数量。

    boolean

    allocate (int bytes, int recordSize)
    Reserve space on the server for the next file transfer.储备空间,为下一个文件传输服务器。

    boolean

    appendFile ( String remote, InputStream local)
    Appends to a file on the server with the given name, taking input from the given InputStream.上的一个带有特定名称的服务器上的文件追加,即从定InputStream输入。

    OutputStream

    appendFileStream ( String remote)
    Returns an OutputStream through which data can be written to append to a file on the server with the given name.返回一个通过该数据可以被写入附加的带有特定名称的服务器上的文件的OutputStream。

    boolean

    changeToParentDirectory ()
    Change to the parent directory of the current working directory.更改为当前工作目录的父目录。

    boolean

    changeWorkingDirectory ( String pathname)
    Change the current working directory of the FTP session.更改的FTP会话的当前工作目录。

    boolean

    completePendingCommand ()
    There are a few FTPClient methods that do not complete the entire sequence of FTP commands to complete a transaction.有几个FTPClient方法不完成整个FTP命令序列来完成交易。

    void

    configure ( FTPClientConfig config)
    Implementation of the Configurable interface.实施Configurable界面。

    boolean

    deleteFile ( String pathname)
    Deletes a file on the FTP server.删除在FTP服务器上的文件。

    void

    disconnect ()
    Closes the connection to the FTP server and restores connection parameters to the default values.关闭到FTP服务器,连接参数恢复到默认值的连接。

    void

    enterLocalActiveMode ()
    Set the current data connection mode to ACTIVE_LOCAL_DATA_CONNECTION_MODE .设置当前数据连接模式ACTIVE_LOCAL_DATA_CONNECTION_MODE 。

    void

    enterLocalPassiveMode ()
    Set the current data connection mode to PASSIVE_LOCAL_DATA_CONNECTION_MODE .设置当前数据连接模式PASSIVE_LOCAL_DATA_CONNECTION_MODE 。

    boolean

    enterRemoteActiveMode ( InetAddress host, int port)
    Set the current data connection mode to ACTIVE_REMOTE_DATA_CONNECTION .设置当前数据连接模式ACTIVE_REMOTE_DATA_CONNECTION 。

    boolean

    enterRemotePassiveMode ()
    Set the current data connection mode to PASSIVE_REMOTE_DATA_CONNECTION_MODE .设置当前数据连接模式PASSIVE_REMOTE_DATA_CONNECTION_MODE 。

    boolean

    features ()
    Query the server for supported features.查询支持的功能服务器。

    int

    getBufferSize ()
    Retrieve the current internal buffer size.检索当前的内部缓冲区的大小。

    int

    getDataConnectionMode ()
    Returns the current data connection mode (one of the _DATA_CONNECTION_MODE constants.返回当前的数据连接模式(一_DATA_CONNECTION_MODE常数。

    protected String

    getListArguments ( String pathname)

    boolean

    getListHiddenFiles ()

    String

    getModificationTime ( String pathname)
    Issue the FTP MDTM command (not supported by all servers to retrieve the last modification time of a file.问题的FTP MDTM命令(并非所有的服务器支持,以获取一个文件的最后修改时间。

    String

    getPassiveHost ()
    Returns the hostname or IP address (in the form of a string) returned by the server when entering passive mode.返回的主机名或IP地址(在一个字符串的形式)时,由服务器返回进入被动模式。

    int

    getPassivePort ()
    If in passive mode, returns the data port of the passive host.如果在被动模式下,返回被动主机的数据端口。

    long

    getRestartOffset ()
    Fetches the restart offset.撷取重新启动所抵消。

    String

    getStatus ()
    Issue the FTP STAT command to the server. STAT命令发出的FTP服务器。

    String

    getStatus ( String pathname)
    Issue the FTP STAT command to the server for a given pathname. STAT命令发出的FTP的服务器为给定的路径名。

    String

    getSystemName ()
    Deprecated. Use getSystemType() - which does not return null. 。弃用 使用getSystemType() -不返回null。 Will be deleted in version 3.0 将3.0版中删除

    String

    getSystemType ()
    Fetches the system type from the server and returns the string.从服务器获取并返回字符串系统类型。

    FTPListParseEngine

    initiateListParsing ()
    Using the default autodetect mechanism, initialize an FTPListParseEngine object containing a raw file information for the current working directory on the server This information is obtained through the LIST command.使用默认的自动检测机制,初始化FTPListParseEngine对象,包含了当前工作的这些信息是通过LIST命令获取服务器目录中的原始文件信息。

    FTPListParseEngine

    initiateListParsing ( String pathname)
    Using the default autodetect mechanism, initialize an FTPListParseEngine object containing a raw file information for the supplied directory.使用默认的自动检测机制,初始化FTPListParseEngine对象,包含了原始文件所提供的目录信息。

    FTPListParseEngine

    initiateListParsing ( String parserKey, String pathname)
    Using the supplied parser key, initialize an FTPListParseEngine object containing a raw file information for the supplied directory.使用提供的解析器的关键,初始化FTPListParseEngine对象,包含了原始文件所提供的目录信息。

    boolean

    isRemoteVerificationEnabled ()
    Return whether or not verification of the remote host participating in data connections is enabled.返回不论是否在数据连接的远程主机参加启用验证。

    boolean

    isUseEPSVwithIPv4 ()
    Whether should attempt to use EPSV with IPv4.是否应该尝试使用与IPv4 EPSV。

    FTPFile []

    listFiles ()
    Using the default system autodetect mechanism, obtain a list of file information for the current working directory.使用默认的系统自动检测机制,获取当前工作目录的文件资料清单。

    FTPFile []

    listFiles ( String pathname)
    Using the default system autodetect mechanism, obtain a list of file information for the current working directory or for just a single file.使用默认的系统自动检测机制,获取当前工作目录或只是一个单一的文件档案资料清单。

    FTPFile []

    listFiles ( String pathname, FTPFileFilter filter)
    Version of listFiles(String) which allows a filter to be provided.从版本listFiles(String)它允许提供过滤器的人。

    String

    listHelp ()
    Fetches the system help information from the server and returns the full string.从服务器获取系统帮助信息并返回完整的字符串。

    String

    listHelp ( String command)
    Fetches the help information for a given command from the server and returns the full string.为获取从服务器提供的命令的帮助信息,并返回完整的字符串。

    String []

    listNames ()
    Obtain a list of filenames in the current working directory This information is obtained through the NLST command.获取当前工作目录的文件名列表,这个信息是通过获得NLST命令。

    String []

    listNames ( String pathname)
    Obtain a list of filenames in a directory (or just the name of a given file, which is not particularly useful).获取列表中一个目录(或者仅仅是对一个给定的文件,它是不是特别有用的名称)文件名。

    boolean

    login ( String username, String password)
    Login to the FTP server using the provided username and password.登录到FTP服务器使用提供的用户名和密码。

    boolean

    login ( String username, String password, String account)
    Login to the FTP server using the provided username, password, and account.登录到FTP服务器使用提供的用户名,密码和帐号。

    boolean

    logout ()
    Logout of the FTP server by sending the QUIT command.注销的通过发送QUIT命令FTP服务器。

    boolean

    makeDirectory ( String pathname)
    Creates a new subdirectory on the FTP server in the current directory (if a relative pathname is given) or where specified (if an absolute pathname is given).在上创建一个FTP服务器的当前目录的子目录(如果给出一个相对路径名),或在指定的(如果给出一个绝对路径名)。

    String

    printWorkingDirectory ()
    Returns the pathname of the current working directory.返回当前工作目录的路径名。

    boolean

    remoteAppend ( String filename)
    Initiate a server to server file transfer.发起一个到服务器的文件传输服务器。

    boolean

    remoteRetrieve ( String filename)
    Initiate a server to server file transfer.发起一个到服务器的文件传输服务器。

    boolean

    remoteStore ( String filename)
    Initiate a server to server file transfer.发起一个到服务器的文件传输服务器。

    boolean

    remoteStoreUnique ()
    Initiate a server to server file transfer.发起一个到服务器的文件传输服务器。

    boolean

    remoteStoreUnique ( String filename)
    Initiate a server to server file transfer.发起一个到服务器的文件传输服务器。

    boolean

    removeDirectory ( String pathname)
    Removes a directory on the FTP server (if empty).删除在FTP服务器(如果是空的)目录。

    boolean

    rename ( String from, String to)
    Renames a remote file.重命名远程文件。

    boolean

    retrieveFile ( String remote, OutputStream local)
    Retrieves a named file from the server and writes it to the given OutputStream.从服务器检索命名文件并将其写入给定的OutputStream。

    InputStream

    retrieveFileStream ( String remote)
    Returns an InputStream from which a named file from the server can be read.返回从其中一个指定的文件从服务器可以读取的InputStream。

    boolean

    sendNoOp ()
    Sends a NOOP command to the FTP server.发送一个NOOP命令到FTP服务器。

    boolean

    sendSiteCommand ( String arguments)
    Send a site specific command.发送一个站点特定的命令。

    void

    setActiveExternalIPAddress ( String ipAddress)
    Set the external IP address in active mode.设置在主动模式下的外部IP地址。

    void

    setActivePortRange (int minPort, int maxPort)
    Set the client side port range in active mode.客户端设置在主动模式端口范围。

    void

    setBufferSize (int bufSize)
    Set the internal buffer size.设置内部缓冲区的大小。

    void

    setDataTimeout (int timeout)
    Sets the timeout in milliseconds to use when reading from the data connection.设置超时时间以毫秒为单位使用时,从数据连接读。

    boolean

    setFileStructure (int structure)
    Sets the file structure.设置文件的结构。

    boolean

    setFileTransferMode (int mode)
    Sets the transfer mode.设置传输模式。

    boolean

    setFileType (int fileType)
    Sets the file type to be transferred.设置文件类型转移。

    boolean

    setFileType (int fileType, int formatOrByteSize)
    Sets the file type to be transferred and the format.设置文件类型和格式传送。

    void

    setListHiddenFiles (boolean listHiddenFiles)
    You can set this to true if you would like to get hidden files when listFiles(java.lang.String) too.您可以设置为true,如果你想获得隐藏的文件时listFiles(java.lang.String)了。

    boolean

    setModificationTime ( String pathname, String timeval)
    Issue the FTP MFMT command (not supported by all servers) which sets the last modified time of a file.问题的FTP MFMT命令(并非所有服务器都支持)中规定的最后修改文件的时间。

    void

    setParserFactory ( FTPFileEntryParserFactory parserFactory)
    set the factory used for parser creation to the supplied factory object.为创建为所提供的解析器工厂对象所使用的工厂。

    void

    setRemoteVerificationEnabled (boolean enable)
    Enable or disable verification that the remote host taking part of a data connection is the same as the host to which the control connection is attached.启用或禁用核实,利用远程主机的数据连接部分是作为控制连接到该连接的主机是相同的。

    void

    setRestartOffset (long offset)
    Sets the restart offset.设置重新启动所抵消。

    void

    setUseEPSVwithIPv4 (boolean selected)
    Set whether to use EPSV with IPv4.设置是否使用与IPv4 EPSV。

    boolean

    storeFile ( String remote, InputStream local)
    Stores a file on the server using the given name and taking input from the given InputStream.存储一个使用给定的名称,并采取从给定的InputStream输入服务器的文件。

    OutputStream

    storeFileStream ( String remote)
    Returns an OutputStream through which data can be written to store a file on the server using the given name.返回一个通过该数据可以被写入存储在使用给定的名称服务器上的文件的OutputStream。

    boolean

    storeUniqueFile ( InputStream local)
    Stores a file on the server using a unique name assigned by the server and taking input from the given InputStream.使用上存储一个唯一的名称由服务器和从给定的InputStream输入到指定的服务器上的文件。

    boolean

    storeUniqueFile ( String remote, InputStream local)
    Stores a file on the server using a unique name derived from the given name and taking input from the given InputStream.使用上存储一个唯一的名称从给定的名称和给定的InputStream输入导出到服务器上的文件。

    OutputStream

    storeUniqueFileStream ()
    Returns an OutputStream through which data can be written to store a file on the server using a unique name assigned by the server.通过返回一个可写入的数据存储上使用一个唯一的名称由服务器分配服务器上的文件的OutputStream。

    OutputStream

    storeUniqueFileStream ( String remote)
    Returns an OutputStream through which data can be written to store a file on the server using a unique name derived from the given name.通过返回一个可写入的数据存储上使用一个唯一的名称从给定的名称派生服务器上的文件的OutputStream。

    boolean

    structureMount ( String pathname)
    Issue the FTP SMNT command.问题的FTP SMNT命令。

     

    Methods inherited from class org.apache.commons.net.ftp. FTP从类继承的方法org.apache.commons.net.ftp。 FTP的

    abor , acct , addProtocolCommandListener , allo , allo , appe , cdup , cwd , dele , eprt , epsv , feat , getControlEncoding , getReply , getReplyCode , getReplyString , getReplyStrings , help , help , isStrictMultilineParsing , list , list , mdtm , mfmt , mkd , mode , nlst , nlst , noop , pass , pasv , port , pwd , quit , rein , removeProtocolCommandListener , rest , retr , rmd , rnfr , rnto , sendCommand , sendCommand , sendCommand , sendCommand , setControlEncoding , setStrictMultilineParsing , site , smnt , stat , stat , stor , stou , stou , stru , syst , type , type , user

     

    Methods inherited from class org.apache.commons.net. SocketClient从类继承的方法org.apache.commons.net。 SocketClient

    connect , connect , connect , connect , connect , connect , getConnectTimeout , getDefaultPort , getDefaultTimeout , getKeepAlive , getLocalAddress , getLocalPort , getRemoteAddress , getRemotePort , getServerSocketFactory , getSoLinger , getSoTimeout , getTcpNoDelay , isConnected , setConnectTimeout , setDefaultPort , setDefaultTimeout , setKeepAlive , setReceiveBufferSize , setSendBufferSize , setServerSocketFactory , setSocketFactory , setSoLinger , setSoTimeout , setTcpNoDelay , verifyRemote

     

    Methods inherited from class java.lang. Object java.lang中的类继承的方法。 对象

    clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait

     

    Field Detail字段详细信息

    ACTIVE_LOCAL_DATA_CONNECTION_MODE ACTIVE_LOCAL_DATA_CONNECTION_MODE

    public static final int ACTIVE_LOCAL_DATA_CONNECTION_MODE公共静态的最终诠释ACTIVE_LOCAL_DATA_CONNECTION_MODE

    A constant indicating the FTP session is expecting all transfers to occur between the client (local) and server and that the server should connect to the client's data port to initiate a data transfer.一个常量指示期待的FTP会话之间发生的所有传输客户端(本地)和服务器,该服务器应该连接到客户端的数据端口来启动数据传输。 This is the default data connection mode when and FTPClient instance is created.这是默认的数据连接模式,当和FTPClient实例被创建。

    See Also:另见:

    Constant Field Values 常量字段值


    ACTIVE_REMOTE_DATA_CONNECTION_MODE ACTIVE_REMOTE_DATA_CONNECTION_MODE

    public static final int ACTIVE_REMOTE_DATA_CONNECTION_MODE公共静态的最终诠释ACTIVE_REMOTE_DATA_CONNECTION_MODE

    A constant indicating the FTP session is expecting all transfers to occur between two remote servers and that the server the client is connected to should connect to the other server's data port to initiate a data transfer.一个常量指示期待的FTP会话的所有转让发生在两个远程服务器,而客户端连接到要连接到其他服务器的数据端口发起数据传输服务器。

    See Also:另见:

    Constant Field Values 常量字段值


    PASSIVE_LOCAL_DATA_CONNECTION_MODE PASSIVE_LOCAL_DATA_CONNECTION_MODE

    public static final int PASSIVE_LOCAL_DATA_CONNECTION_MODE公共静态的最终诠释PASSIVE_LOCAL_DATA_CONNECTION_MODE

    A constant indicating the FTP session is expecting all transfers to occur between the client (local) and server and that the server is in passive mode, requiring the client to connect to the server's data port to initiate a transfer.一个常量指示期待的FTP会话之间发生的所有传输客户端(本地)和服务器,服务器在被动模式时,要求客户端连接到服务器的数据端口来启动传输。

    See Also:另见:

    Constant Field Values 常量字段值


    PASSIVE_REMOTE_DATA_CONNECTION_MODE PASSIVE_REMOTE_DATA_CONNECTION_MODE

    public static final int PASSIVE_REMOTE_DATA_CONNECTION_MODE公共静态的最终诠释PASSIVE_REMOTE_DATA_CONNECTION_MODE

    A constant indicating the FTP session is expecting all transfers to occur between two remote servers and that the server the client is connected to is in passive mode, requiring the other server to connect to the first server's data port to initiate a data transfer.一个常量指示期待的FTP会话的所有转让发生在两个远程服务器,而客户端连接到处于被动模式,要求其他服务器连接到第一个服务器的数据端口发起数据传输服务器。

    See Also:另见:

    Constant Field Values 常量字段值

    Constructor Detail构造方法详细

    FTPClient FTPClient

    public FTPClient ()公共FTPClient ()

    Default FTPClient constructor.默认FTPClient构造。 Creates a new FTPClient instance with the data connection mode set to ACTIVE_LOCAL_DATA_CONNECTION_MODE , the file type set to FTP.ASCII_FILE_TYPE , the file format set to FTP.NON_PRINT_TEXT_FORMAT , the file structure set to FTP.FILE_STRUCTURE , and the transfer mode set to FTP.STREAM_TRANSFER_MODE .创建一个模式设置为新FTPClient实例与连接的数据ACTIVE_LOCAL_DATA_CONNECTION_MODE ,文件类型设置为FTP.ASCII_FILE_TYPE ,文件格式设置为FTP.NON_PRINT_TEXT_FORMAT ,文件结构设置为FTP.FILE_STRUCTURE和传输模式设置为FTP.STREAM_TRANSFER_MODE 。

    Method Detail方法详细

    _openDataConnection_ _openDataConnection_

    protected Socket _openDataConnection_ (int command,保护插座 _openDataConnection_ (智力命令,

                                          String arg) 字符串参数)

                                   throws IOException抛出IOException异常

    Establishes a data connection with the FTP server, returning a Socket for the connection if successful.建立一个与FTP服务器的数据连接,如果返回的成功连接的Socket。 If a restart offset has been set with setRestartOffset(long) , a REST command is issued to the server with the offset as an argument before establishing the data connection.如果重新启动已与偏移设置setRestartOffset(long) ,休息命令颁发给服务器的参数偏移量,为在建立数据连接。 Active mode connections also cause a local PORT command to be issued.主动模式的连接也造成本地端口命令发出。

    Parameters:参数:

    command - The text representation of the FTP command to send. command -要发送的文字表示的FTP命令。

    arg - The arguments to the FTP command. arg -命令参数的FTP。 If this parameter is set to null, then the command is sent with no argument.如果这个参数设置为null,则发送该命令没有参数。

    Returns:返回:

    A Socket corresponding to the established data connection.一个Socket对应建立的数据连接。 Null is returned if an FTP protocol error is reported at any point during the establishment and initialization of the connection.如果返回null FTP协议中的任何错误,在建立和初始化的连接点的报告。

    Throws:抛出:

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    _connectAction_ _connectAction_

    protected void _connectAction_ ()保护无效_connectAction_ ()

                            throws IOException抛出IOException异常

    Description copied from class: FTP从阶级复制的描述: FTP

    Initiates control connections and gets initial reply.启动控制连接,并得到初步答复。 Initializes FTP._controlInput_ and FTP._controlOutput_ .初始化FTP._controlInput_FTP._controlOutput_

    Overrides:覆盖:

    _connectAction_ in class FTP _connectAction_在课堂上FTP

    Throws:抛出:

    IOException


    setDataTimeout setDataTimeout

    public void setDataTimeout (int timeout)公共无效setDataTimeout (智力超时)

    Sets the timeout in milliseconds to use when reading from the data connection.设置超时时间以毫秒为单位使用时,从数据连接读。 This timeout will be set immediately after opening the data connection.此超时将被设置后立即打开数据连接。

    Parameters:参数:

    timeout - The default timeout in milliseconds that is used when opening a data connection socket. timeout -默认的超时时间以毫秒为单位,用来当打开一个数据连接插座。


    setParserFactory setParserFactory

    public void setParserFactory ( FTPFileEntryParserFactory parserFactory)公共无效setParserFactory FTPFileEntryParserFactory parserFactory)

    set the factory used for parser creation to the supplied factory object.为创建为所提供的解析器工厂对象所使用的工厂。

    Parameters:参数:

    parserFactory - factory object used to create FTPFileEntryParsers parserFactory -工厂对象用于创建FTPFileEntryParsers

    See Also:另见:

    FTPFileEntryParserFactory , DefaultFTPFileEntryParserFactory FTPFileEntryParserFactory DefaultFTPFileEntryParserFactory


    disconnect断开

    public void disconnect ()公共无效断开 ()

                    throws IOException抛出IOException异常

    Closes the connection to the FTP server and restores connection parameters to the default values.关闭到FTP服务器,连接参数恢复到默认值的连接。

    Overrides:覆盖:

    disconnect in class FTP disconnect在课堂上FTP

    Throws:抛出:

    IOException - If an error occurs while disconnecting. IOException -如果发生错误而断开。


    setRemoteVerificationEnabled setRemoteVerificationEnabled

    public void setRemoteVerificationEnabled (boolean enable)公共无效setRemoteVerificationEnabled (布尔启用)

    Enable or disable verification that the remote host taking part of a data connection is the same as the host to which the control connection is attached.启用或禁用核实,利用远程主机的数据连接部分是作为控制连接到该连接的主机是相同的。 The default is for verification to be enabled.默认值是核实被启用。 You may set this value at any time, whether the FTPClient is currently connected or not.你可以在任何时候设置此值,是否FTPClient当前连接与否。

    Parameters:参数:

    enable - True to enable verification, false to disable verification. enable -真正使核查,虚假禁用验证。


    isRemoteVerificationEnabled isRemoteVerificationEnabled

    public boolean isRemoteVerificationEnabled ()公共布尔isRemoteVerificationEnabled ()

    Return whether or not verification of the remote host participating in data connections is enabled.返回不论是否在数据连接的远程主机参加启用验证。 The default behavior is for verification to be enabled.默认行为是核实被启用。

    Returns:返回:

    True if verification is enabled, false if not.真如果验证被启用,否则为false。


    login登录

    public boolean login ( String username,公共布尔登录 弦乐用户名,

                         String password) 字符串密码)

                  throws IOException抛出IOException异常

    Login to the FTP server using the provided username and password.登录到FTP服务器使用提供的用户名和密码。

    Parameters:参数:

    username - The username to login under. username -根据登录的用户名。

    password - The password to use. password -密码使用。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    login登录

    public boolean login ( String username,公共布尔登录 弦乐用户名,

                         String password, 字符串的密码,

                         String account) 字符串帐户)

                  throws IOException抛出IOException异常

    Login to the FTP server using the provided username, password, and account.登录到FTP服务器使用提供的用户名,密码和帐号。 If no account is required by the server, only the username and password, the account information is not used.如果不考虑由服务器,只需要用户名和密码,帐户信息不被使用。

    Parameters:参数:

    username - The username to login under. username -根据登录的用户名。

    password - The password to use. password -密码使用。

    account - The account to use. account -该帐户使用。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    logout注销

    public boolean logout ()公共布尔注销 ()

                   throws IOException抛出IOException异常

    Logout of the FTP server by sending the QUIT command.注销的通过发送QUIT命令FTP服务器。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    changeWorkingDirectory changeWorkingDirectory

    public boolean changeWorkingDirectory ( String pathname)公共布尔changeWorkingDirectory 字符串路径名)

                                   throws IOException抛出IOException异常

    Change the current working directory of the FTP session.更改的FTP会话的当前工作目录。

    Parameters:参数:

    pathname - The new current working directory. pathname -新的当前工作目录。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    changeToParentDirectory changeToParentDirectory

    public boolean changeToParentDirectory ()公共布尔changeToParentDirectory ()

                                    throws IOException抛出IOException异常

    Change to the parent directory of the current working directory.更改为当前工作目录的父目录。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    structureMount structureMount

    public boolean structureMount ( String pathname)公共布尔structureMount 字符串路径名)

                           throws IOException抛出IOException异常

    Issue the FTP SMNT command.问题的FTP SMNT命令。

    Parameters:参数:

    pathname - The pathname to mount. pathname -路径名上升。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    enterLocalActiveMode enterLocalActiveMode

    public void enterLocalActiveMode ()公共无效enterLocalActiveMode ()

    Set the current data connection mode to ACTIVE_LOCAL_DATA_CONNECTION_MODE .设置当前数据连接模式ACTIVE_LOCAL_DATA_CONNECTION_MODE 。 No communication with the FTP server is conducted, but this causes all future data transfers to require the FTP server to connect to the client's data port.没有与FTP服务器进行通信,但是这会导致所有将来的数据传输要求的FTP服务器连接到客户端的数据端口。 Additionally, to accommodate differences between socket implementations on different platforms, this method causes the client to issue a PORT command before every data transfer.此外,为了适应插座之间的差异在不同平台上实现,这种方法使客户端发出一个摆在每一个数据传输端口的命令。


    enterLocalPassiveMode enterLocalPassiveMode

    public void enterLocalPassiveMode ()公共无效enterLocalPassiveMode ()

    Set the current data connection mode to PASSIVE_LOCAL_DATA_CONNECTION_MODE .设置当前数据连接模式PASSIVE_LOCAL_DATA_CONNECTION_MODE 。 Use this method only for data transfers between the client and server.仅用于客户端和服务器之间的数据传输,此方法。 This method causes a PASV (or EPSV) command to be issued to the server before the opening of every data connection, telling the server to open a data port to which the client will connect to conduct data transfers.这种方法将导致使用PASV(或EPSV)命令发出到服务器之前,每一个数据连接孔,告诉服务器来打开一个数据端口,客户端将连接进行数据传输。 The FTPClient will stay in PASSIVE_LOCAL_DATA_CONNECTION_MODE until the mode is changed by calling some other method such as enterLocalActiveMode()该FTPClient将留在PASSIVE_LOCAL_DATA_CONNECTION_MODE直到模式是由其他的方法,例如改变调用一些enterLocalActiveMode()

    NB currently calling any connect method will reset the mode to ACTIVE_LOCAL_DATA_CONNECTION_MODE.注:目前可以调用任何方法将复位模式ACTIVE_LOCAL_DATA_CONNECTION_MODE。


    enterRemoteActiveMode enterRemoteActiveMode

    public boolean enterRemoteActiveMode ( InetAddress host,公共布尔enterRemoteActiveMode InetAddress的主机,

                                         int port)诠释端口)

                                  throws IOException抛出IOException异常

    Set the current data connection mode to ACTIVE_REMOTE_DATA_CONNECTION .设置当前数据连接模式ACTIVE_REMOTE_DATA_CONNECTION 。 Use this method only for server to server data transfers.仅用于服务器到服务器的数据传输此方法。 This method issues a PORT command to the server, indicating the other server and port to which it should connect for data transfers.这种方法发出PORT命令到服务器,显示服务器和端口等它应该连接进行数据传输。 You must call this method before EVERY server to server transfer attempt.您必须调用这个摆在每一个服务器到服务器传输尝试的方法。 The FTPClient will NOT automatically continue to issue PORT commands.该FTPClient不会自动继续发出PORT命令。 You also must remember to call enterLocalActiveMode() if you wish to return to the normal data connection mode.你还必须记住调用enterLocalActiveMode()如果你想返回到正常的数据连接模式。

    Parameters:参数:

    host - The passive mode server accepting connections for data transfers. host -被动模式的服务器接受连接,进行数据传输。

    port - The passive mode server's data port. port -被动模式的服务器的数据端口。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    enterRemotePassiveMode enterRemotePassiveMode

    public boolean enterRemotePassiveMode ()公共布尔enterRemotePassiveMode ()

                                   throws IOException抛出IOException异常

    Set the current data connection mode to PASSIVE_REMOTE_DATA_CONNECTION_MODE .设置当前数据连接模式PASSIVE_REMOTE_DATA_CONNECTION_MODE 。 Use this method only for server to server data transfers.仅用于服务器到服务器的数据传输此方法。 This method issues a PASV command to the server, telling it to open a data port to which the active server will connect to conduct data transfers.这种方法发出PASV命令到服务器,告诉它打开一个数据端口的活动服务器将连接进行数据传输。 You must call this method before EVERY server to server transfer attempt.您必须调用这个摆在每一个服务器到服务器传输尝试的方法。 The FTPClient will NOT automatically continue to issue PASV commands.该FTPClient不会自动继续发行PASV命令。 You also must remember to call enterLocalActiveMode() if you wish to return to the normal data connection mode.你还必须记住调用enterLocalActiveMode()如果你想返回到正常的数据连接模式。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    getPassiveHost getPassiveHost

    public String getPassiveHost ()公共字符串 getPassiveHost ()

    Returns the hostname or IP address (in the form of a string) returned by the server when entering passive mode.返回的主机名或IP地址(在一个字符串的形式)时,由服务器返回进入被动模式。 If not in passive mode, returns null.如果不是在被动模式,则返回null。 This method only returns a valid value AFTER a data connection has been opened after a call to enterLocalPassiveMode() .这种方法只返回一个有效的值后的数据连接已经打开后调用enterLocalPassiveMode() This is because FTPClient sends a PASV command to the server only just before opening a data connection, and not when you call enterLocalPassiveMode() .这是因为FTPClient发送之前打开数据连接PASV命令到服务器只,而不是当你调用enterLocalPassiveMode()

    Returns:返回:

    The passive host name if in passive mode, otherwise null.如果在被动的被动模式,否则无效的主机名。


    getPassivePort getPassivePort

    public int getPassivePort ()公共诠释getPassivePort ()

    If in passive mode, returns the data port of the passive host.如果在被动模式下,返回被动主机的数据端口。 This method only returns a valid value AFTER a data connection has been opened after a call to enterLocalPassiveMode() .这种方法只返回一个有效的值后的数据连接已经打开后调用enterLocalPassiveMode() This is because FTPClient sends a PASV command to the server only just before opening a data connection, and not when you call enterLocalPassiveMode() .这是因为FTPClient发送之前打开数据连接PASV命令到服务器只,而不是当你调用enterLocalPassiveMode()

    Returns:返回:

    The data port of the passive server.被动式服务器数据端口。 If not in passive mode, undefined.如果不是在被动模式下,不确定的。


    getDataConnectionMode getDataConnectionMode

    public int getDataConnectionMode ()公共诠释getDataConnectionMode ()

    Returns the current data connection mode (one of the _DATA_CONNECTION_MODE constants.返回当前的数据连接模式(一_DATA_CONNECTION_MODE常数。

    Returns:返回:

    The current data connection mode (one of the _DATA_CONNECTION_MODE constants.目前的数据连接模式(一_DATA_CONNECTION_MODE常数。


    setActivePortRange setActivePortRange

    public void setActivePortRange (int minPort,公共无效setActivePortRange (智力minPort,

                                   int maxPort)诠释maxPort)

    Set the client side port range in active mode.客户端设置在主动模式端口范围。

    Parameters:参数:

    minPort - The lowest available port (inclusive). minPort -最低可用的端口(含)。

    maxPort - The highest available port (inclusive). maxPort -最高可用的端口(含)。

    Since:因为:

    2.2 2.2


    setActiveExternalIPAddress setActiveExternalIPAddress

    public void setActiveExternalIPAddress ( String ipAddress)公共无效setActiveExternalIPAddress 弦乐的IPAddress)

                                    throws UnknownHostException抛出UnknownHostException

    Set the external IP address in active mode.设置在主动模式下的外部IP地址。 Useful when there are multiple network cards.有用当有多个网卡。

    Parameters:参数:

    ipAddress - The external IP address of this machine. ipAddress -机器的外部IP地址这一点。

    Throws:抛出:

    UnknownHostException

    Since:因为:

    2.2 2.2


    setFileType setFileType

    public boolean setFileType (int fileType)公共布尔setFileType (智力文件类型)

                        throws IOException抛出IOException异常

    Sets the file type to be transferred.设置文件类型转移。 This should be one of FTP.ASCII_FILE_TYPE , FTP.BINARY_FILE_TYPE , etc. The file type only needs to be set when you want to change the type.这应该是一个FTP.ASCII_FILE_TYPE , FTP.BINARY_FILE_TYPE等文件类型只需要设置当你想改变的类型。 After changing it, the new type stays in effect until you change it again.在改变了,新的类型保持有效,直到您再次变更。 The default file type is FTP.ASCII_FILE_TYPE if this method is never called.默认的文件类型是FTP.ASCII_FILE_TYPE如果这种方法不会被调用。

    NB currently calling any connect method will reset the mode to ACTIVE_LOCAL_DATA_CONNECTION_MODE.注:目前可以调用任何方法将复位模式ACTIVE_LOCAL_DATA_CONNECTION_MODE。

    Parameters:参数:

    fileType - The _FILE_TYPE constant indcating the type of file. fileType -的_FILE_TYPE不断indcating的文件类型。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    setFileType setFileType

    public boolean setFileType (int fileType,公共布尔setFileType (智力文件类型,

                               int formatOrByteSize)诠释formatOrByteSize)

                        throws IOException抛出IOException异常

    Sets the file type to be transferred and the format.设置文件类型和格式传送。 The type should be one of FTP.ASCII_FILE_TYPE , FTP.BINARY_FILE_TYPE , etc. The file type only needs to be set when you want to change the type.类型应该是一个FTP.ASCII_FILE_TYPE , FTP.BINARY_FILE_TYPE等文件类型只需要设置当你想改变的类型。 After changing it, the new type stays in effect until you change it again.在改变了,新的类型保持有效,直到您再次变更。 The default file type is FTP.ASCII_FILE_TYPE if this method is never called.默认的文件类型是FTP.ASCII_FILE_TYPE如果这种方法不会被调用。 The format should be one of the FTP class TEXT_FORMAT constants, or if the type is FTP.LOCAL_FILE_TYPE , the format should be the byte size for that type.格式应该是一个阶级的FTP TEXT_FORMAT常数,或者如果该类型是FTP.LOCAL_FILE_TYPE ,格式应该是该类型的字节大小。 The default format is FTP.NON_PRINT_TEXT_FORMAT if this method is never called.默认格式是FTP.NON_PRINT_TEXT_FORMAT如果这种方法不会被调用。

    NB currently calling any connect method will reset the mode to ACTIVE_LOCAL_DATA_CONNECTION_MODE.注:目前可以调用任何方法将复位模式ACTIVE_LOCAL_DATA_CONNECTION_MODE。

    Parameters:参数:

    fileType - The _FILE_TYPE constant indcating the type of file. fileType -的_FILE_TYPE不断indcating的文件类型。

    formatOrByteSize - The format of the file (one of the _FORMAT constants. In the case of LOCAL_FILE_TYPE , the byte size. formatOrByteSize -文件格式的(即一_FORMAT常数。若LOCAL_FILE_TYPE ,字节大小。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    setFileStructure setFileStructure

    public boolean setFileStructure (int structure)公共布尔setFileStructure (智力结构)

                             throws IOException抛出IOException异常

    Sets the file structure.设置文件的结构。 The default structure is FTP.FILE_STRUCTURE if this method is never called.默认的结构是FTP.FILE_STRUCTURE如果这种方法不会被调用。

    Parameters:参数:

    structure - The structure of the file (one of the FTP class _STRUCTURE constants). structure -文件结构(类之一的FTP _STRUCTURE常量)。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    setFileTransferMode setFileTransferMode

    public boolean setFileTransferMode (int mode)公共布尔setFileTransferMode (智力模式)

                                throws IOException抛出IOException异常

    Sets the transfer mode.设置传输模式。 The default transfer mode FTP.STREAM_TRANSFER_MODE if this method is never called.默认的传输模式FTP.STREAM_TRANSFER_MODE如果这种方法不会被调用。

    Parameters:参数:

    mode - The new transfer mode to use (one of the FTP class _TRANSFER_MODE constants). mode -新的传输模式使用(一类的FTP _TRANSFER_MODE常量)。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    remoteRetrieve remoteRetrieve

    public boolean remoteRetrieve ( String filename)公共布尔remoteRetrieve 字符串文件名)

                           throws IOException抛出IOException异常

    Initiate a server to server file transfer.发起一个到服务器的文件传输服务器。 This method tells the server to which the client is connected to retrieve a given file from the other server.此方法通知服务器的客户端连接到其他服务器中检索从一个给定的文件。

    Parameters:参数:

    filename - The name of the file to retrieve. filename -文件名称检索。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    remoteStore remoteStore

    public boolean remoteStore ( String filename)公共布尔remoteStore 字符串文件名)

                        throws IOException抛出IOException异常

    Initiate a server to server file transfer.发起一个到服务器的文件传输服务器。 This method tells the server to which the client is connected to store a file on the other server using the given filename.此方法通知服务器的客户端连接到存储在其他使用给定的文件名服务器上的文件。 The other server must have had a remoteRetrieve issued to it by another FTPClient.其他服务器必须有一个remoteRetrieve发出另FTPClient给它。

    Parameters:参数:

    filename - The name to call the file that is to be stored. filename -这个名字来调用文件要存储。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    remoteStoreUnique remoteStoreUnique

    public boolean remoteStoreUnique ( String filename)公共布尔remoteStoreUnique 字符串文件名)

                              throws IOException抛出IOException异常

    Initiate a server to server file transfer.发起一个到服务器的文件传输服务器。 This method tells the server to which the client is connected to store a file on the other server using a unique filename based on the given filename.此方法通知服务器的客户端连接到存储在其他服务器上的文件使用一个唯一的文件名在给定的文件为基础。 The other server must have had a remoteRetrieve issued to it by another FTPClient.其他服务器必须有一个remoteRetrieve发出另FTPClient给它。

    Parameters:参数:

    filename - The name on which to base the filename of the file that is to be stored. filename -这个名字,在此基础文件的文件名是被存储。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    remoteStoreUnique remoteStoreUnique

    public boolean remoteStoreUnique ()公共布尔remoteStoreUnique ()

                              throws IOException抛出IOException异常

    Initiate a server to server file transfer.发起一个到服务器的文件传输服务器。 This method tells the server to which the client is connected to store a file on the other server using a unique filename.此方法通知服务器的客户端连接到存储在其他唯一的文件名使用服务器上的文件。 The other server must have had a remoteRetrieve issued to it by another FTPClient.其他服务器必须有一个remoteRetrieve发出另FTPClient给它。 Many FTP servers require that a base filename be given from which the unique filename can be derived.许多FTP服务器要求给予基础文件名唯一的文件名从中可以得到。 For those servers use the other version of remoteStoreUnique对于这些服务器使用的版本的其他remoteStoreUnique

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    remoteAppend remoteAppend

    public boolean remoteAppend ( String filename)公共布尔remoteAppend 字符串文件名)

                         throws IOException抛出IOException异常

    Initiate a server to server file transfer.发起一个到服务器的文件传输服务器。 This method tells the server to which the client is connected to append to a given file on the other server.此方法通知服务器的客户端连接到其他服务器上追加到指定文件。 The other server must have had a remoteRetrieve issued to it by another FTPClient.其他服务器必须有一个remoteRetrieve发出另FTPClient给它。

    Parameters:参数:

    filename - The name of the file to be appended to, or if the file does not exist, the name to call the file being stored. filename -文件名称追加到,或者如果该文件不存在,这个名字来调用文件被存储。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    completePendingCommand completePendingCommand

    public boolean completePendingCommand ()公共布尔completePendingCommand ()

                                   throws IOException抛出IOException异常

    There are a few FTPClient methods that do not complete the entire sequence of FTP commands to complete a transaction.有几个FTPClient方法不完成整个FTP命令序列来完成交易。 These commands require some action by the programmer after the reception of a positive intermediate command.这些命令的一些要求后的一个积极的中级指挥接待程序员行动。 After the programmer's code completes its actions, it must call this method to receive the completion reply from the server and verify the success of the entire transaction.之后,程序员的代码完成其行动,它必须调用这个方法来接收来自服务器的答复,并确认完成了整个交易的成功。

    For example,例如,

     InputStream input; InputStream的投入;

     OutputStream output; OutputStream的输出;

     input = new FileInputStream("foobaz.txt");输入=新FileInputStream的(“foobaz.txt”);

     output = ftp.storeFileStream("foobar.txt")输出= ftp.storeFileStream(“foobar.txt”)

     if(!FTPReply.isPositiveIntermediate(ftp.getReplyCode())) {如果(!FTPReply.isPositiveIntermediate(ftp.getReplyCode())){

         input.close(); input.close();

         output.close(); output.close();

         ftp.logout(); ftp.logout();

         ftp.disconnect(); ftp.disconnect();

         System.err.println("File transfer failed."); System.err.println(“文件传输失败。”);

         System.exit(1); System.exit(1);

     } }

     Util.copyStream(input, output); Util.copyStream(输入,输出);

     input.close(); input.close();

     output.close(); output.close();

     // Must call completePendingCommand() to finish command. / /必须调用completePendingCommand()来完成命令。

     if(!ftp.completePendingCommand()) {如果(!ftp.completePendingCommand()){

         ftp.logout(); ftp.logout();

         ftp.disconnect(); ftp.disconnect();

         System.err.println("File transfer failed."); System.err.println(“文件传输失败。”);

         System.exit(1); System.exit(1);

     } }

     

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    retrieveFile retrieveFile

    public boolean retrieveFile ( String remote,公共布尔retrieveFile 弦乐遥远,

                                OutputStream local) OutputStream的地方)

                         throws IOException抛出IOException异常

    Retrieves a named file from the server and writes it to the given OutputStream.从服务器检索命名文件并将其写入给定的OutputStream。 This method does NOT close the given OutputStream.这种方法不会关闭给定的OutputStream。 If the current file type is ASCII, line separators in the file are converted to the local representation.如果当前文件类型是ASCII,文件中的行分隔符转换为当地代表性。

    Note: if you have used setRestartOffset(long) , the file data will start from the selected offset.注:如果您使用过setRestartOffset(long) ,该文件的数据将开始从选定的偏移。

    Parameters:参数:

    remote - The name of the remote file. remote -文件名遥控器。

    local - The local OutputStream to which to write the file. local -当地的OutputStream要写入文件。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    CopyStreamException - If an I/O error occurs while actually transferring the file. CopyStreamException -如果发生I / O错误,而实际上传输文件。 The CopyStreamException allows you to determine the number of bytes transferred and the IOException causing the error.该CopyStreamException允许你确定传输的字节数和IOException异常导致错误。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    retrieveFileStream retrieveFileStream

    public InputStream retrieveFileStream ( String remote)公众的InputStream retrieveFileStream 字符串远程)

                                   throws IOException抛出IOException异常

    Returns an InputStream from which a named file from the server can be read.返回从其中一个指定的文件从服务器可以读取的InputStream。 If the current file type is ASCII, the returned InputStream will convert line separators in the file to the local representation.如果当前文件类型是ASCII,返回的InputStream将转换文件中的行分隔符到本地的代表性。 You must close the InputStream when you finish reading from it.您必须关闭InputStream的当你完成从它读。 The InputStream itself will take care of closing the parent data connection socket upon being closed.本身的InputStream将被关闭,关闭后父数据连接插座的照顾。 To finalize the file transfer you must call completePendingCommand and check its return value to verify success.为了完成文件传输你必须调用completePendingCommand并检查它的返回值来验证成功。

    Note: if you have used setRestartOffset(long) , the file data will start from the selected offset.注:如果您使用过setRestartOffset(long) ,该文件的数据将开始从选定的偏移。

    Parameters:参数:

    remote - The name of the remote file. remote -文件名遥控器。

    Returns:返回:

    An InputStream from which the remote file can be read.一个InputStream,从中可以读取远程文件。 If the data connection cannot be opened (eg, the file does not exist), null is returned (in which case you may check the reply code to determine the exact reason for failure).如果数据连接不能打开(例如,文件不存在),则返回null(在这种情况下,您可以检查答复代码以确定失败的确切原因)。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    storeFile storeFile

    public boolean storeFile ( String remote,公共布尔storeFile 弦乐遥远,

                             InputStream local) InputStream的地方)

                      throws IOException抛出IOException异常

    Stores a file on the server using the given name and taking input from the given InputStream.存储一个使用给定的名称,并采取从给定的InputStream输入服务器的文件。 This method does NOT close the given InputStream.这种方法不会关闭给定的InputStream。 If the current file type is ASCII, line separators in the file are transparently converted to the NETASCII format (ie, you should not attempt to create a special InputStream to do this).如果当前文件类型是ASCII,文件中的行分隔符转换为NETASCII透明格式(比如,你不应该试图建立一个特别的InputStream要做到这一点)。

    Parameters:参数:

    remote - The name to give the remote file. remote -这个名字给远程文件。

    local - The local InputStream from which to read the file. local -当地的InputStream从中读取文件。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    CopyStreamException - If an I/O error occurs while actually transferring the file. CopyStreamException -如果发生I / O错误,而实际上传输文件。 The CopyStreamException allows you to determine the number of bytes transferred and the IOException causing the error.该CopyStreamException允许你确定传输的字节数和IOException异常导致错误。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    storeFileStream storeFileStream

    public OutputStream storeFileStream ( String remote)公众的OutputStream storeFileStream 字符串远程)

                                 throws IOException抛出IOException异常

    Returns an OutputStream through which data can be written to store a file on the server using the given name.返回一个通过该数据可以被写入存储在使用给定的名称服务器上的文件的OutputStream。 If the current file type is ASCII, the returned OutputStream will convert line separators in the file to the NETASCII format (ie, you should not attempt to create a special OutputStream to do this).如果当前文件类型是ASCII,返回的OutputStream将转换文件中的行分隔符的NETASCII格式(比如,你不应该试图建立一个特别的OutputStream要做到这一点)。 You must close the OutputStream when you finish writing to it.您必须关闭的OutputStream当你写完它。 The OutputStream itself will take care of closing the parent data connection socket upon being closed.本身的OutputStream将被关闭,关闭后父数据连接插座的照顾。 To finalize the file transfer you must call completePendingCommand and check its return value to verify success.为了完成文件传输你必须调用completePendingCommand并检查它的返回值来验证成功。

    Parameters:参数:

    remote - The name to give the remote file. remote -这个名字给远程文件。

    Returns:返回:

    An OutputStream through which the remote file can be written.一个OutputStream通过该远程文件可写。 If the data connection cannot be opened (eg, the file does not exist), null is returned (in which case you may check the reply code to determine the exact reason for failure).如果数据连接不能打开(例如,文件不存在),则返回null(在这种情况下,您可以检查答复代码以确定失败的确切原因)。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    appendFile appendFile

    public boolean appendFile ( String remote,公共布尔appendFile 弦乐遥远,

                              InputStream local) InputStream的地方)

                       throws IOException抛出IOException异常

    Appends to a file on the server with the given name, taking input from the given InputStream.上的一个带有特定名称的服务器上的文件追加,即从定InputStream输入。 This method does NOT close the given InputStream.这种方法不会关闭给定的InputStream。 If the current file type is ASCII, line separators in the file are transparently converted to the NETASCII format (ie, you should not attempt to create a special InputStream to do this).如果当前文件类型是ASCII,文件中的行分隔符转换为NETASCII透明格式(比如,你不应该试图建立一个特别的InputStream要做到这一点)。

    Parameters:参数:

    remote - The name of the remote file. remote -文件名遥控器。

    local - The local InputStream from which to read the data to be appended to the remote file. local -当地的InputStream从中读取数据被追加到远程文件。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    CopyStreamException - If an I/O error occurs while actually transferring the file. CopyStreamException -如果发生I / O错误,而实际上传输文件。 The CopyStreamException allows you to determine the number of bytes transferred and the IOException causing the error.该CopyStreamException允许你确定传输的字节数和IOException异常导致错误。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    appendFileStream appendFileStream

    public OutputStream appendFileStream ( String remote)公众的OutputStream appendFileStream 字符串远程)

                                  throws IOException抛出IOException异常

    Returns an OutputStream through which data can be written to append to a file on the server with the given name.返回一个通过该数据可以被写入附加的带有特定名称的服务器上的文件的OutputStream。 If the current file type is ASCII, the returned OutputStream will convert line separators in the file to the NETASCII format (ie, you should not attempt to create a special OutputStream to do this).如果当前文件类型是ASCII,返回的OutputStream将转换文件中的行分隔符的NETASCII格式(比如,你不应该试图建立一个特别的OutputStream要做到这一点)。 You must close the OutputStream when you finish writing to it.您必须关闭的OutputStream当你写完它。 The OutputStream itself will take care of closing the parent data connection socket upon being closed.本身的OutputStream将被关闭,关闭后父数据连接插座的照顾。 To finalize the file transfer you must call completePendingCommand and check its return value to verify success.为了完成文件传输你必须调用completePendingCommand并检查它的返回值来验证成功。

    Parameters:参数:

    remote - The name of the remote file. remote -文件名遥控器。

    Returns:返回:

    An OutputStream through which the remote file can be appended.一个OutputStream通过该远程文件可以追加。 If the data connection cannot be opened (eg, the file does not exist), null is returned (in which case you may check the reply code to determine the exact reason for failure).如果数据连接不能打开(例如,文件不存在),则返回null(在这种情况下,您可以检查答复代码以确定失败的确切原因)。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    storeUniqueFile storeUniqueFile

    public boolean storeUniqueFile ( String remote,公共布尔storeUniqueFile 弦乐遥远,

                                   InputStream local) InputStream的地方)

                            throws IOException抛出IOException异常

    Stores a file on the server using a unique name derived from the given name and taking input from the given InputStream.使用上存储一个唯一的名称从给定的名称和给定的InputStream输入导出到服务器上的文件。 This method does NOT close the given InputStream.这种方法不会关闭给定的InputStream。 If the current file type is ASCII, line separators in the file are transparently converted to the NETASCII format (ie, you should not attempt to create a special InputStream to do this).如果当前是ASCII文件类型,文件中的行分隔符转换为NETASCII透明格式(比如,你不应该试图创建一个特殊的InputStream要做到这一点)。

    Parameters:参数:

    remote - The name on which to base the unique name given to the remote file. remote -这个名字,在此基础独特的名字给远程文件。

    local - The local InputStream from which to read the file. local -当地的InputStream从中读取文件。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    CopyStreamException - If an I/O error occurs while actually transferring the file. CopyStreamException -如果发生I / O错误,而实际上传输文件。 The CopyStreamException allows you to determine the number of bytes transferred and the IOException causing the error.该CopyStreamException允许你确定传输的字节数和IOException异常导致错误。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    storeUniqueFileStream storeUniqueFileStream

    public OutputStream storeUniqueFileStream ( String remote)公众的OutputStream storeUniqueFileStream 字符串远程)

                                       throws IOException抛出IOException异常

    Returns an OutputStream through which data can be written to store a file on the server using a unique name derived from the given name.通过返回一个可写入的数据存储上使用一个唯一的名称从给定的名称派生服务器上的文件的OutputStream。 If the current file type is ASCII, the returned OutputStream will convert line separators in the file to the NETASCII format (ie, you should not attempt to create a special OutputStream to do this).如果当前文件类型是ASCII,返回的OutputStream将转换文件中的行分隔符的NETASCII格式(比如,你不应该试图建立一个特别的OutputStream要做到这一点)。 You must close the OutputStream when you finish writing to it.您必须关闭的OutputStream当你写完它。 The OutputStream itself will take care of closing the parent data connection socket upon being closed.本身的OutputStream将被关闭,关闭后父数据连接插座的照顾。 To finalize the file transfer you must call completePendingCommand and check its return value to verify success.为了完成文件传输你必须调用completePendingCommand并检查它的返回值来验证成功。

    Parameters:参数:

    remote - The name on which to base the unique name given to the remote file. remote -这个名字,在此基础独特的名字给远程文件。

    Returns:返回:

    An OutputStream through which the remote file can be written.一个OutputStream通过该远程文件可写。 If the data connection cannot be opened (eg, the file does not exist), null is returned (in which case you may check the reply code to determine the exact reason for failure).如果数据连接不能打开(例如,文件不存在),则返回null(在这种情况下,您可以检查答复代码以确定失败的确切原因)。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    storeUniqueFile storeUniqueFile

    public boolean storeUniqueFile ( InputStream local)公共布尔storeUniqueFile InputStream的地方)

                            throws IOException抛出IOException异常

    Stores a file on the server using a unique name assigned by the server and taking input from the given InputStream.使用上存储一个唯一的名称由服务器和从给定的InputStream输入到指定的服务器上的文件。 This method does NOT close the given InputStream.这种方法不会关闭给定的InputStream。 If the current file type is ASCII, line separators in the file are transparently converted to the NETASCII format (ie, you should not attempt to create a special InputStream to do this).如果当前文件类型是ASCII,文件中的行分隔符转换为NETASCII透明格式(比如,你不应该试图建立一个特别的InputStream要做到这一点)。

    Parameters:参数:

    local - The local InputStream from which to read the file. local -当地的InputStream从中读取文件。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    CopyStreamException - If an I/O error occurs while actually transferring the file. CopyStreamException -如果发生I / O错误,而实际上传输文件。 The CopyStreamException allows you to determine the number of bytes transferred and the IOException causing the error.该CopyStreamException允许你确定传输的字节数和IOException异常导致错误。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    storeUniqueFileStream storeUniqueFileStream

    public OutputStream storeUniqueFileStream ()公众的OutputStream storeUniqueFileStream ()

                                       throws IOException抛出IOException异常

    Returns an OutputStream through which data can be written to store a file on the server using a unique name assigned by the server.通过返回一个可写入的数据存储上使用一个唯一的名称由服务器分配服务器上的文件的OutputStream。 If the current file type is ASCII, the returned OutputStream will convert line separators in the file to the NETASCII format (ie, you should not attempt to create a special OutputStream to do this).如果当前文件类型是ASCII,返回的OutputStream将转换该文件中的行分隔符的NETASCII格式(比如,你不应该试图建立一个特别的OutputStream要做到这一点)。 You must close the OutputStream when you finish writing to it.您必须关闭的OutputStream当你写完它。 The OutputStream itself will take care of closing the parent data connection socket upon being closed.本身的OutputStream将被关闭,关闭后父数据连接插座的照顾。 To finalize the file transfer you must call completePendingCommand and check its return value to verify success.为了完成文件传输你必须调用completePendingCommand并检查它的返回值来验证成功。

    Returns:返回:

    An OutputStream through which the remote file can be written.一个OutputStream通过该远程文件可写。 If the data connection cannot be opened (eg, the file does not exist), null is returned (in which case you may check the reply code to determine the exact reason for failure).如果数据连接不能打开(例如,文件不存在),则返回null(在这种情况下,您可以检查答复代码以确定失败的确切原因)。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    allocate分配

    public boolean allocate (int bytes)公共布尔分配 (智力字节)

                     throws IOException抛出IOException异常

    Reserve a number of bytes on the server for the next file transfer.保留一字节的下一个文件传输服务器数量。

    Parameters:参数:

    bytes - The number of bytes which the server should allocate. bytes -字节数的分配,服务器应该。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    features特征

    public boolean features ()公共布尔特征 ()

                     throws IOException抛出IOException异常

    Query the server for supported features.查询支持的功能服务器。 The server may reply with a list of server-supported exensions.服务器可能会回复了服务器支持exensions名单。 For example, a typical client-server interaction might be (from RFC 2289):例如,一个典型的客户机服务器相互作用可能是(从RFC 2289):

            C> feat ç>壮举

            S> 211-Extensions supported: S> 211 -扩展支持:

            S> MLST size*;create;modify*;perm;media-type S> MLST大小*;创造;修改*,烫发,媒体类型

            S> SIZE S>尺寸

            S> COMPRESSION S>压缩

            S> MDTM S> MDTM

            S> 211 END S> 211

     

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    IOException

    Since:因为:

    2.2 2.2

    See Also:另见:

    http://www.faqs.org/rfcs/rfc2389.html http://www.faqs.org/rfcs/rfc2389.html


    allocate分配

    public boolean allocate (int bytes,公共布尔分配 (智力字节,

                            int recordSize)诠释的recordsize)

                     throws IOException抛出IOException异常

    Reserve space on the server for the next file transfer.储备空间,为下一个文件传输服务器。

    Parameters:参数:

    bytes - The number of bytes which the server should allocate. bytes -字节数的分配,服务器应该。

    recordSize - The size of a file record. recordSize -记录大小的文件。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    setRestartOffset setRestartOffset

    public void setRestartOffset (long offset)公共无效setRestartOffset (长偏移)

    Sets the restart offset.设置重新启动所抵消。 The restart command is sent to the server only before sending the file transfer command.重新启动命令发送到服务器前,只发送文件传输命令。 When this is done, the restart marker is reset to zero.当这完成,重新启动标记重置为零。

    Parameters:参数:

    offset - The offset into the remote file at which to start the next file transfer. offset -偏移到远程文件要开始下一个文件传输。 This must be a value greater than or equal to zero.这必须是一个大于或等于零。


    getRestartOffset getRestartOffset

    public long getRestartOffset ()众长getRestartOffset ()

    Fetches the restart offset.撷取重新启动所抵消。

    Returns:返回:

    offset The offset into the remote file at which to start the next file transfer.远程文件偏移量,偏移量开始下一个文件传输。


    rename重命名

    public boolean rename ( String from,公共布尔命名 字符串从,

                          String to) 字符串来)

                   throws IOException抛出IOException异常

    Renames a remote file.重命名远程文件。

    Parameters:参数:

    from - The name of the remote file to rename. from -文件名遥控器来重命名。

    to - The new name of the remote file. to -远程文件的新名称。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    abort退出

    public boolean abort ()公共布尔中止 ()

                  throws IOException抛出IOException异常

    Abort a transfer in progress.中止正在进行的传输。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    deleteFile的DeleteFile

    public boolean deleteFile ( String pathname)公共布尔的DeleteFile 字符串路径名)

                       throws IOException抛出IOException异常

    Deletes a file on the FTP server.删除在FTP服务器上的文件。

    Parameters:参数:

    pathname - The pathname of the file to be deleted. pathname -文件路径名被删除。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    removeDirectory removeDirectory

    public boolean removeDirectory ( String pathname)公共布尔removeDirectory 字符串路径名)

                            throws IOException抛出IOException异常

    Removes a directory on the FTP server (if empty).删除在FTP服务器(如果是空的)目录。

    Parameters:参数:

    pathname - The pathname of the directory to remove. pathname -删除路径名的目录。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    makeDirectory makeDirectory

    public boolean makeDirectory ( String pathname)公共布尔makeDirectory 字符串路径名)

                          throws IOException抛出IOException异常

    Creates a new subdirectory on the FTP server in the current directory (if a relative pathname is given) or where specified (if an absolute pathname is given).在上创建一个FTP服务器的当前目录的子目录(如果给出一个相对路径名),或在指定的(如果给出一个绝对路径名)。

    Parameters:参数:

    pathname - The pathname of the directory to create. pathname -创建路径名的目录。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    printWorkingDirectory printWorkingDirectory

    public String printWorkingDirectory ()公共字符串 printWorkingDirectory ()

                                 throws IOException抛出IOException异常

    Returns the pathname of the current working directory.返回当前工作目录的路径名。

    Returns:返回:

    The pathname of the current working directory.当前工作目录的路径名。 If it cannot be obtained, returns null.如果不能获得,则返回null。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    sendSiteCommand sendSiteCommand

    public boolean sendSiteCommand ( String arguments)公共布尔sendSiteCommand 字符串参数)

                            throws IOException抛出IOException异常

    Send a site specific command.发送一个站点特定的命令。

    Parameters:参数:

    arguments - The site specific command and arguments. arguments -该网站的具体命令和参数。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    getSystemName getSystemName

    @Deprecated @已过时

     public String getSystemName ()公共字符串 getSystemName ()

                         throws IOException抛出IOException异常

    Deprecated. Use getSystemType() - which does not return null.。弃用 使用getSystemType() -不返回null。 Will be deleted in version 3.0 将3.0版中删除

    Fetches the system type name from the server and returns the string.从服务器获取并返回字符串系统类型的名称。 This value is cached for the duration of the connection after the first call to this method.这个值是缓存后的第一次调用此方法连接的持续时间。 In other words, only the first time that you invoke this method will it issue a SYST command to the FTP server.换句话说,只有第一次调用此方法将它发出SYST命令到FTP服务器。 FTPClient will remember the value and return the cached value until a call to disconnect. FTPClient会记得值,并返回到调用断开缓存值。

    Returns:返回:

    The system type name obtained from the server.该系统类型的名称取自服务器。 null if the information could not be obtained. NULL,如果无法获得的信息。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    getSystemType getSystemType

    public String getSystemType ()公共字符串 getSystemType ()

                         throws IOException抛出IOException异常

    Fetches the system type from the server and returns the string.从服务器获取并返回字符串系统类型。 This value is cached for the duration of the connection after the first call to this method.这个值是缓存后的第一次调用此方法连接的持续时间。 In other words, only the first time that you invoke this method will it issue a SYST command to the FTP server.换句话说,只有第一次调用此方法将它发出SYST命令到FTP服务器。 FTPClient will remember the value and return the cached value until a call to disconnect. FTPClient会记得值,并返回到调用断开缓存值。

    Returns:返回:

    The system type obtained from the server.该系统从服务器获得的类型。 Never null.切勿空。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。

    Since:因为:

    2.2 2.2


    listHelp listHelp

    public String listHelp ()公共字符串 listHelp ()

                    throws IOException抛出IOException异常

    Fetches the system help information from the server and returns the full string.从服务器获取系统帮助信息并返回完整的字符串。

    Returns:返回:

    The system help string obtained from the server.该系统的帮助下从服务器获得的字符串。 null if the information could not be obtained. NULL,如果无法获得的信息。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    listHelp listHelp

    public String listHelp ( String command)公共字符串 listHelp 字符串命令)

                    throws IOException抛出IOException异常

    Fetches the help information for a given command from the server and returns the full string.为获取从服务器提供的命令的帮助信息,并返回完整的字符串。

    Parameters:参数:

    command - The command on which to ask for help. command -命令在其上寻求帮助。

    Returns:返回:

    The command help string obtained from the server.该命令的帮助字符串获得服务器。 null if the information could not be obtained. NULL,如果无法获得的信息。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    sendNoOp sendNoOp

    public boolean sendNoOp ()公共布尔sendNoOp ()

                     throws IOException抛出IOException异常

    Sends a NOOP command to the FTP server.发送一个NOOP命令到FTP服务器。 This is useful for preventing server timeouts.这是为防止服务器超时有用。

    Returns:返回:

    True if successfully completed, false if not. True如果成功完成,否则为false。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    listNames listNames

    public String [] listNames ( String pathname)公共字符串 [] listNames 字符串路径名)

                       throws IOException抛出IOException异常

    Obtain a list of filenames in a directory (or just the name of a given file, which is not particularly useful).获取列表中一个目录(或者仅仅是对一个给定的文件,它是不是特别有用的名称)文件名。 This information is obtained through the NLST command.获得这些信息通过NLST命令。 If the given pathname is a directory and contains no files, a zero length array is returned only if the FTP server returned a positive completion code, otherwise null is returned (the FTP server returned a 550 error No files found.).如果给定的路径名是一个目录,不包含任何文件,一个零长度数组只返回如果FTP服务器返回一个积极的完成代码,否则返回null(在FTP服务器返回一个550错误号文件中找到。)。 If the directory is not empty, an array of filenames in the directory is returned.如果该目录不是空的,一个目录中的文件名数组返回。 If the pathname corresponds to a file, only that file will be listed.如果路径名对应一个文件,只是文件将陆续上市。 The server may or may not expand glob expressions.服务器可能会或可能不会扩大glob表达式。

    Parameters:参数:

    pathname - The file or directory to list. pathname -文件或目录清单。

    Returns:返回:

    The list of filenames contained in the given path.清单中的文件名在给定的路径。 null if the list could not be obtained.如果列表为空无法取得。 If there are no filenames in the directory, a zero-length array is returned.如果在目录中没有文件名,一个零长度的数组返回。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    listNames listNames

    public String [] listNames ()公共字符串 [] listNames ()

                       throws IOException抛出IOException异常

    Obtain a list of filenames in the current working directory This information is obtained through the NLST command.获取当前工作目录的文件名列表,这个信息是通过获得NLST命令。 If the current directory contains no files, a zero length array is returned only if the FTP server returned a positive completion code, otherwise, null is returned (the FTP server returned a 550 error No files found.).如果当前目录不包含任何文件,一个零长度的数组返回只有当FTP服务器返回了积极的完成代码,否则,返回null(在FTP服务器返回一个550错误号文件中找到。)。 If the directory is not empty, an array of filenames in the directory is returned.如果该目录不是空的,一个目录中的文件名数组返回。

    Returns:返回:

    The list of filenames contained in the current working directory.清单中的文件名在当前工作目录。 null if the list could not be obtained.如果列表为空无法取得。 If there are no filenames in the directory, a zero-length array is returned.如果在目录中没有文件名,一个零长度的数组返回。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    listFiles listfiles <套件

    public FTPFile [] listFiles ( String pathname)公共FTPFile [] listfiles <套件 字符串路径名)

                        throws IOException抛出IOException异常

    Using the default system autodetect mechanism, obtain a list of file information for the current working directory or for just a single file.使用默认的系统自动检测机制,获取当前工作目录或只是一个单一的文件档案资料清单。

    This information is obtained through the LIST command.获得这些信息通过list命令。 The contents of the returned array is determined by the FTPFileEntryParser used.返回的数组的内容是由FTPFileEntryParser使用。

    Parameters:参数:

    pathname - The file or directory to list. pathname -文件或目录清单。 Since the server may or may not expand glob expressions, using them here is not recommended and may well cause this method to fail.由于服务器可能会或可能不会扩大glob表达式,使用起来这里不推荐,很可能导致这个方法失败。

    Returns:返回:

    The list of file information contained in the given path in the format determined by the autodetection mechanism信息表的文件在给定的路径中包含由自动检测机制确定的格式

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。

    ParserInitializationException - Thrown if the parserKey parameter cannot be resolved by the selected parser factory. ParserInitializationException -抛出如果parserKey参数不能被选中的解决解析器工厂。 In the DefaultFTPEntryParserFactory, this will happen when parserKey is neither the fully qualified class name of a class implementing the interface org.apache.commons.net.ftp.FTPFileEntryParser nor a string containing one of the recognized keys mapping to such a parser or if class loader security issues prevent its being loaded.在DefaultFTPEntryParserFactory,这将发生在parserKey既不是一个实现该接口org.apache.commons.net.ftp.FTPFileEntryParser,也不是一个字符串,其中包含一个确认键映射到这样一个分析器或者类的类的全限定类名装载机安全问题防止其被加载。

    See Also:另见:

    DefaultFTPFileEntryParserFactory , FTPFileEntryParserFactory , FTPFileEntryParser DefaultFTPFileEntryParserFactory FTPFileEntryParserFactory FTPFileEntryParser


    listFiles listfiles <套件

    public FTPFile [] listFiles ()公共FTPFile [] listfiles <套件 ()

                        throws IOException抛出IOException异常

    Using the default system autodetect mechanism, obtain a list of file information for the current working directory.使用默认的系统自动检测机制,获取当前工作目录的文件资料清单。

    This information is obtained through the LIST command.获得这些信息通过list命令。 The contents of the returned array is determined by the FTPFileEntryParser used.返回的数组的内容是由FTPFileEntryParser使用。

    Returns:返回:

    The list of file information contained in the current directory in the format determined by the autodetection mechanism.该文件中包含的信息的列表中自动检测机制决定的格式的当前目录。

    NOTE: This array may contain null members if any of the individual file listings failed to parse.注意:此数组可能包含空成员,如果上市文件的任何个人无法解析。 The caller should check each entry for null before referencing it.调用者前,必须核对每个空引用它的条目。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。

    ParserInitializationException - Thrown if the parserKey parameter cannot be resolved by the selected parser factory. ParserInitializationException -抛出如果parserKey参数不能被选中的解决解析器工厂。 In the DefaultFTPEntryParserFactory, this will happen when parserKey is neither the fully qualified class name of a class implementing the interface org.apache.commons.net.ftp.FTPFileEntryParser nor a string containing one of the recognized keys mapping to such a parser or if class loader security issues prevent its being loaded.在DefaultFTPEntryParserFactory,这将发生在parserKey既不是一个实现该接口org.apache.commons.net.ftp.FTPFileEntryParser,也不是一个字符串,其中包含一个确认键映射到这样一个分析器或者类的类的全限定类名装载机安全问题防止其被加载。

    See Also:另见:

    DefaultFTPFileEntryParserFactory , FTPFileEntryParserFactory , FTPFileEntryParser DefaultFTPFileEntryParserFactory FTPFileEntryParserFactory FTPFileEntryParser


    listFiles listfiles <套件

    public FTPFile [] listFiles ( String pathname,公共FTPFile [] listfiles <套件 字符串路径名,

                               FTPFileFilter filter) FTPFileFilter过滤器)

                        throws IOException抛出IOException异常

    Version of listFiles(String) which allows a filter to be provided.从版本listFiles(String)它允许提供过滤器的人。 For example: listFiles("site", FTPFileFilters.DIRECTORY);例如: listFiles("site", FTPFileFilters.DIRECTORY);

    Parameters:参数:

    pathname - the initial path, may be null pathname -初始路径,可以为null

    filter - the filter, non-null filter -过滤器,非空

    Returns:返回:

    the list of FTPFile entries.对FTPFile项目清单。

    Throws:抛出:

    IOException

    Since:因为:

    2.2 2.2


    initiateListParsing initiateListParsing

    public FTPListParseEngine initiateListParsing ()公共FTPListParseEngine initiateListParsing ()

                                           throws IOException抛出IOException异常

    Using the default autodetect mechanism, initialize an FTPListParseEngine object containing a raw file information for the current working directory on the server This information is obtained through the LIST command.使用默认的自动检测机制,初始化FTPListParseEngine对象,包含了当前工作的这些信息是通过LIST命令获取服务器目录中的原始文件信息。 This object is then capable of being iterated to return a sequence of FTPFile objects with information filled in by the FTPFileEntryParser used.然后,这个对象能够被迭代的,以信息来填充返回对象FTPFile一序列FTPFileEntryParser使用。

    This method differs from using the listFiles() methods in that expensive FTPFile objects are not created until needed which may be an advantage on large lists.此方法不同于使用listfiles <套件(),因为昂贵的FTPFile不创建对象的方法之前,需要的可能是一个大名单的优势。

    Returns:返回:

    A FTPListParseEngine object that holds the raw information and is capable of providing parsed FTPFile objects, one for each file containing information contained in the given path in the format determined by the parser parameter.一个FTPListParseEngine对象,保存原始资料,是能够通过提供解析FTPFile对象,每一个确定的格式文件,其中包含的信息是包含在给定路径parser参数。 Null will be returned if a data connection cannot be opened.如果将返回空数据连接无法打开。 If the current working directory contains no files, an empty array will be the return.如果当前的工作目录包含任何文件,将一个空数组返回。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。

    ParserInitializationException - Thrown if the autodetect mechanism cannot resolve the type of system we are connected with. ParserInitializationException -抛出,如果不能自动检测机制,解决与类型的系统,我们都是相连的。

    See Also:另见:

    FTPListParseEngine


    initiateListParsing initiateListParsing

    public FTPListParseEngine initiateListParsing ( String pathname)公共FTPListParseEngine initiateListParsing 字符串路径名)

                                           throws IOException抛出IOException异常

    Using the default autodetect mechanism, initialize an FTPListParseEngine object containing a raw file information for the supplied directory.使用默认的自动检测机制,初始化FTPListParseEngine对象,包含了原始文件所提供的目录信息。 This information is obtained through the LIST command.获得这些信息通过list命令。 This object is then capable of being iterated to return a sequence of FTPFile objects with information filled in by the FTPFileEntryParser used.然后,这个对象能够被迭代的,以信息来填充返回对象FTPFile一序列FTPFileEntryParser使用。

    The server may or may not expand glob expressions.服务器可能会或可能不会扩大glob表达式。 You should avoid using glob expressions because the return format for glob listings differs from server to server and will likely cause this method to fail.你应该避免使用glob表达式,因为上市的水珠返回格式不同于服务器到服务器,将可能导致这个方法失败。

    This method differs from using the listFiles() methods in that expensive FTPFile objects are not created until needed which may be an advantage on large lists.此方法不同于使用listfiles <套件(),因为昂贵的FTPFile不创建对象的方法之前,需要的可能是一个大名单的优势。

        FTPClient f=FTPClient(); FTPClient f = FTPClient();

        f.connect(server); f.connect(服务器);

        f.login(username, password); f.login(用户名,密码);

        FTPListParseEngine engine = f.initiateListParsing(directory); FTPListParseEngine引擎= f.initiateListParsing(目录);

     

        while (engine.hasNext()) {而(engine.hasNext()){

           FTPFile[] files = engine.getNext(25); // "page size" you want FTPFile []文件= engine.getNext(25); / /“页面大小”你想要

           //do whatever you want with these files, display them, etc. / /做你想做这些文件,显示它们,等

           //expensive FTPFile objects not created until needed. / /昂贵FTPFile不创建对象,直到需要。

        } }

     

    Returns:返回:

    A FTPListParseEngine object that holds the raw information and is capable of providing parsed FTPFile objects, one for each file containing information contained in the given path in the format determined by the parser parameter.一个FTPListParseEngine对象,保存原始资料,是能够通过提供解析FTPFile对象,每一个确定的格式文件,其中包含的信息是包含在给定路径parser参数。 Null will be returned if a data connection cannot be opened.如果将返回空数据连接无法打开。 If the current working directory contains no files, an empty array will be the return.如果当前的工作目录包含任何文件,将一个空数组返回。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。

    ParserInitializationException - Thrown if the autodetect mechanism cannot resolve the type of system we are connected with. ParserInitializationException -抛出,如果不能自动检测机制,解决与类型的系统,我们都是相连的。

    See Also:另见:

    FTPListParseEngine


    initiateListParsing initiateListParsing

    public FTPListParseEngine initiateListParsing ( String parserKey,公共FTPListParseEngine initiateListParsing 弦乐 parserKey,

                                                  String pathname) 字符串路径名)

                                           throws IOException抛出IOException异常

    Using the supplied parser key, initialize an FTPListParseEngine object containing a raw file information for the supplied directory.使用提供的解析器的关键,初始化FTPListParseEngine对象,包含了原始文件所提供的目录信息。 This information is obtained through the LIST command.获得这些信息通过list命令。 This object is then capable of being iterated to return a sequence of FTPFile objects with information filled in by the FTPFileEntryParser used.然后,这个对象能够被迭代的,以信息来填充返回对象FTPFile一序列FTPFileEntryParser使用。

    The server may or may not expand glob expressions.服务器可能会或可能不会扩大glob表达式。 You should avoid using glob expressions because the return format for glob listings differs from server to server and will likely cause this method to fail.你应该避免使用glob表达式,因为上市的水珠返回格式不同于服务器到服务器,将可能导致这个方法失败。

    This method differs from using the listFiles() methods in that expensive FTPFile objects are not created until needed which may be an advantage on large lists.此方法不同于使用listfiles <套件(),因为昂贵的FTPFile不创建对象的方法之前,需要的可能是一个大名单的优势。

    Parameters:参数:

    parserKey - A string representing a designated code or fully-qualified class name of an FTPFileEntryParser that should be used to parse each server file listing. parserKey -一个字符串,代表一个指定的代码或限定类名的全FTPFileEntryParser应该用来分析每个服务器文件列表。

    Returns:返回:

    A FTPListParseEngine object that holds the raw information and is capable of providing parsed FTPFile objects, one for each file containing information contained in the given path in the format determined by the parser parameter.一个FTPListParseEngine对象,保存原始资料,是能够通过提供解析FTPFile对象,每一个确定的格式文件,其中包含的信息是包含在给定路径parser参数。 Null will be returned if a data connection cannot be opened.如果将返回空数据连接无法打开。 If the current working directory contains no files, an empty array will be the return.如果当前的工作目录包含任何文件,将一个空数组返回。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。

    ParserInitializationException - Thrown if the parserKey parameter cannot be resolved by the selected parser factory. ParserInitializationException -抛出如果parserKey参数不能被选中的解决解析器工厂。 In the DefaultFTPEntryParserFactory, this will happen when parserKey is neither the fully qualified class name of a class implementing the interface org.apache.commons.net.ftp.FTPFileEntryParser nor a string containing one of the recognized keys mapping to such a parser or if class loader security issues prevent its being loaded.在DefaultFTPEntryParserFactory,这将发生在parserKey既不是一个实现该接口org.apache.commons.net.ftp.FTPFileEntryParser,也不是一个字符串,其中包含一个确认键映射到这样一个分析器或者类的类的全限定类名装载机安全问题防止其被加载。

    See Also:另见:

    FTPListParseEngine


    getListArguments getListArguments

    protected String getListArguments ( String pathname)保护字符串 getListArguments 字符串路径名)

    Since:因为:

    2.0 2.0


    getStatus getStatus

    public String getStatus ()公共字符串 getStatus ()

                     throws IOException抛出IOException异常

    Issue the FTP STAT command to the server. STAT命令发出的FTP服务器。

    Returns:返回:

    The status information returned by the server.返回的状态信息的服务器。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    getStatus getStatus

    public String getStatus ( String pathname)公共字符串 getStatus 字符串路径名)

                     throws IOException抛出IOException异常

    Issue the FTP STAT command to the server for a given pathname. STAT命令发出的FTP的服务器为给定的路径名。 This should produce a listing of the file or directory.本应产生的文件或目录清单。

    Returns:返回:

    The status information returned by the server.返回的状态信息的服务器。

    Throws:抛出:

    FTPConnectionClosedException - If the FTP server prematurely closes the connection as a result of the client being idle or some other reason causing the server to send FTP reply code 421. FTPConnectionClosedException -如果FTP服务器过早关闭连接的代码421,结果答复的客户端被闲置或其他原因导致服务器发送的FTP。 This exception may be caught either as an IOException or independently as itself.此异常可能陷于无论是作为一个IOException或本身独立。

    IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server. IOException -如果发生I / O错误发生,而不是一个命令发送到服务器或接收服务器响应从。


    getModificationTime getModificationTime

    public String getModificationTime ( String pathname)公共字符串 getModificationTime 字符串路径名)

                               throws IOException抛出IOException异常

    Issue the FTP MDTM command (not supported by all servers to retrieve the last modification time of a file. The modification string should be in the ISO 3077 form "YYYYMMDDhhmmss(.xxx)?". The timestamp represented should also be in GMT, but not all FTP servers honour this.问题的FTP MDTM命令(不支持所有的服务器来检索文件的最后修改时间。字符串的修改应在ISO 3077表“YYYYMMDDhhmmss(。三十)?”。时间戳代表也应该在格林尼治标准时间,但并非所有的FTP服务器,这个荣誉。

    Parameters:参数:

    pathname - The file path to query. pathname -文件路径查询。

    Returns:返回:

    A string representing the last file modification time in YYYYMMDDhhmmss format.一个字符串,表示最后一个文件时间修改YYYYMMDDhhmmss格式。

    Throws:抛出:

    IOException - if an I/O error occurs. IOException -如果发生I / O错误。

    Since:因为:

    2.0 2.0


    setModificationTime setModificationTime

    public boolean setModificationTime ( String pathname,公共布尔setModificationTime 字符串路径名,

                                       String timeval) 字符串 timeval

                                throws IOException抛出IOException异常

    Issue the FTP MFMT command (not supported by all servers) which sets the last modified time of a file.问题的FTP MFMT命令(并非所有服务器都支持)中规定的最后修改文件的时间。 The timestamp should be in the form YYYYMMDDhhmmss .时间戳记应在表格YYYYMMDDhhmmss 。 It should also be in GMT, but not all servers honour this.它也应该在格林尼治标准时间,但并非所有的服务器的荣誉的。 An FTP server would indicate its support of this feature by including "MFMT" in its response to the FEAT command, which may be retrieved by FTPClient.features() FTP服务器将表明,包括在应对这一壮举的命令,这可能是由FTPClient.features(取自“MFMT”对这一功能的支持)

    Parameters:参数:

    pathname - The file path for which last modified time is to be changed. pathname -文件路径的最后修改时间是要改变。

    timeval - The timestamp to set to, in YYYYMMDDhhmmss format. timeval -时间戳设定为,在YYYYMMDDhhmmss格式。

    Returns:返回:

    true if successfully set, false if not true,如果设置成功,否则为false

    Throws:抛出:

    IOException - if an I/O error occurs. IOException -如果发生I / O错误。

    Since:因为:

    2.2 2.2

    See Also:另见:

    http://tools.ietf.org/html/draft-somers-ftp-mfxx-04 http://tools.ietf.org/html/draft-somers-ftp-mfxx-04


    setBufferSize setBufferSize

    public void setBufferSize (int bufSize)公共无效setBufferSize (智力bufSize)

    Set the internal buffer size.设置内部缓冲区的大小。

    Parameters:参数:

    bufSize - The size of the buffer bufSize -缓冲区的大小


    getBufferSize getBufferSize

    public int getBufferSize ()公共诠释getBufferSize ()

    Retrieve the current internal buffer size.检索当前的内部缓冲区的大小。

    Returns:返回:

    The current buffer size.当前缓冲区的大小。


    configure配置

    public void configure ( FTPClientConfig config)公共无效配置 FTPClientConfig配置)

    Implementation of the Configurable interface.实施Configurable界面。 In the case of this class, configuring merely makes the config object available for the factory methods that construct parsers.在这个类的情况下,配置只是使配置对象的工厂方法构造解析器。

    Specified by:指定者:

    configure in interface Configurable configure在接口Configurable

    Parameters:参数:

    config - FTPClientConfig object used to provide non-standard configurations to the parser. config - FTPClientConfig对象,用于提供非标准配置,分析器。

    Since:因为:

    1.4 1.4


    setListHiddenFiles setListHiddenFiles

    public void setListHiddenFiles (boolean listHiddenFiles)公共无效setListHiddenFiles (布尔listHiddenFiles)

    You can set this to true if you would like to get hidden files when listFiles(java.lang.String) too.您可以设置为true,如果你想获得隐藏的文件时listFiles(java.lang.String)了。 A LIST -a will be issued to the ftp server.一个LIST -a会发出到FTP服务器。 It depends on your ftp server if you need to call this method, also dont expect to get rid of hidden files if you call this method with "false".这取决于您的FTP服务器,如果你需要调用这个方法,也不要期望得到消除隐藏文件,如果你调用“假”这个方法。

    Parameters:参数:

    listHiddenFiles - true if hidden files should be listed listHiddenFiles - True如果隐藏的文件应列出

    Since:因为:

    2.0 2.0


    getListHiddenFiles getListHiddenFiles

    public boolean getListHiddenFiles ()公共布尔getListHiddenFiles ()

    Returns:返回:

    the current state当前状态

    Since:因为:

    2.0 2.0

    See Also:另见:

    setListHiddenFiles(boolean)


    isUseEPSVwithIPv4 isUseEPSVwithIPv4

    public boolean isUseEPSVwithIPv4 ()公共布尔isUseEPSVwithIPv4 ()

    Whether should attempt to use EPSV with IPv4.是否应该尝试使用与IPv4 EPSV。 Default (if not set) is false默认(如果没有设置)是false

    Returns:返回:

    true if should attempt EPS如果要尝试真正的每股收益

    Since:因为:

    2.2 2.2


    setUseEPSVwithIPv4 setUseEPSVwithIPv4

    public void setUseEPSVwithIPv4 (boolean selected)公共无效setUseEPSVwithIPv4 (布尔选择)

    Set whether to use EPSV with IPv4.设置是否使用与IPv4 EPSV。 Might be worth enabling in some circumstances.也许值得在某些情况下启用。 For example, when using IPv4 with NAT it may work with some rare configurations.例如,当使用IPv4和NAT它可能与某些罕见的配置。 Eg if FTP server has a static PASV address (external network) and the client is coming from another internal network.例如,如果FTP服务器有一个静态的使用PASV地址(外部网)和客户端是来自另一个内部网络。 In that case the data connection after PASV command would fail, while EPSV would make the client succeed by taking just the port.在这种情况下,PASV命令后,数据连接会失败,而EPSV将使客户获得成功,采取公正的端口。

    Parameters:参数:

    selected - value to set. selected -要设置的值。

    Since:因为: 2.2 2.2

  • 相关阅读:
    Java多态的学习
    Java显示的静态初始化和非静态实例初始化
    Java类方法访问权限
    JavaScript数组详解
    JavaScript倒计时的具体实现
    JavaScript之Date对象
    JavaScript内置对象之Math对象
    JavaScript对象
    JS的作用域,作用域链及预解析
    JavaScript函数
  • 原文地址:https://www.cnblogs.com/aipan/p/7456481.html
Copyright © 2011-2022 走看看