2024年4月1日发(作者:)

java实现ftp的几种方式(第3方包)

最近在做ssh ,sftp。顺便总结一下java实现ftp的几种方式。

.StringTokenizer;

public class FtpUpfile {

private FtpClient ftpclient;

private String ipAddress;

private int ipPort;

private String userName;

private String PassWord;

/**

* 构造函数

* @param ip String 机器IP

* @param port String 机器FTP端口号

* @param username String FTP用户名

* @param password String FTP密码

* @throws Exception

*/

public FtpUpfile(String ip, int port, String username, String password) thro

ws

Exception {

ipAddress = new String(ip);

ipPort = port;

ftpclient = new FtpClient(ipAddress, ipPort);

//ftpclient = new FtpClient(ipAddress);

userName = new String(username);

PassWord = new String(password);

}