FTP客戶端Java開源類庫 edtFTPj 2.3.0 發布

碼頭工人 13年前發布 | 16K 次閱讀 FTP Java

edtFTPj是一個FTP客戶端庫,可讓任何Java應用程序能有充分的嵌入式FTP功能。它包括一個易于使用的API的方法,如 downloadFile() 和uploadFile() 。大多數FTP命令的支持,并主動和被動模式。 edFTPj已被廣泛的測試,并已廣泛應用于成千上萬的項目。
示例代碼:

/*
 * 
 * Copyright (C) 2006 Enterprise Distributed Technologies Ltd
 * 
 * www.enterprisedt.com
 */

import com.enterprisedt.net.ftp.FileTransferClient;
import com.enterprisedt.util.debug.Level;
import com.enterprisedt.util.debug.Logger;

public class ConnectToServer {

    public static void main(String[] args) {

        // we want remote host, user name and password
        if (args.length < 3) {
            System.out
                    .println("Usage: run remote-host username password");
            System.exit(1);
        }

        // extract command-line arguments
        String host = args[0];
        String username = args[1];
        String password = args[2];

        // set up logger so that we get some output
        Logger log = Logger.getLogger(ConnectToServer.class);
        Logger.setLevel(Level.INFO);

        FileTransferClient ftp = null;

        try {
            // create client
            log.info("Creating FTP client");
            ftp = new FileTransferClient();

            // set remote host
            log.info("Setting remote host");
            ftp.setRemoteHost(host);
            ftp.setUserName(username);
            ftp.setPassword(password);

            // connect to the server
            log.info("Connecting to server " + host);
            ftp.connect();
            log.info("Connected and logged in to server " + host);

            // Shut down client
            log.info("Quitting client");
            ftp.disconnect();

            log.info("Example complete");

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}

變化:

1. Support was added for using ACCT in FileTransferClient.
2. FTPFile.getPath() no longer includes the filename.
3. A bug was fixed in MLST parser.
4. An empty array of features is returned if FEAT returns no features (but is implemented by the server).
5. The array is tweaked so that only actual features are returned

 本文由用戶 碼頭工人 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!