- /**
- * FIP客户端
- * 类库 jftp.jar
- * 输入参数 FTP主机名或者IP地址、用户名、密码、待下载的远程文件名、待上传的本地文件名
- * */
- //import net.sf.jftp.net.ConnectionHandler;
- //import net.sf.jftp.net.ConnectionListener;
- //import net.sf.jftp.net.DataConnection;
- import net.sf.jftp.net.FtpConnection; //负责与FTP服务器交互的功能类
- //import net.sf.jftp.util.Log;
- //import net.sf.jftp.util.Logger;
- public class FTPClient // implements Logger, ConnectionListener
- {
- public FTPClient(String host, String user, String password,
- String downloadfile, String uploadfile) {//读取输入参数
- // Log.setLogger(this);
- // ConnectionHandler.setConnectionListener(this);
- FtpConnection con = new FtpConnection(host);
- con.login(user, password);
- con.download(downloadfile);
- con.upload(uploadfile);
- }
- public static void main(String argv[]) {
- FTPClient f = new FTPClient(argv[0], argv[1], argv[2], argv[3], argv[4]);
- }
- /*
- * public void debugWrite(String msg) {}
- *
- * public void updateRemoteDirectory(FtpConnection con) {}
- *
- * public void connectionInitialized(FtpConnection con) {}
- *
- * public void updateProgress(DataConnection con, String file, String type,
- * int bytes) {}
- *
- * public void connectionFailed(FtpConnection con)
- * {System.out.println("connection failed!");}
- *
- * public void debug(String msg) {System.out.println(msg);}
- *
- * public void debug(String msg, Throwable throwable) {}
- *
- * public void warn(String msg) {}
- *
- * public void warn(String msg, Throwable throwable) {}
- *
- * public void error(String msg) {}
- *
- * public void error(String msg, Throwable throwable) {}
- *
- * public void info(String msg) {}
- *
- * public void info(String msg, Throwable throwable) {}
- *
- * public void fatal(String msg) {}
- *
- * public void fatal(String msg, Throwable throwable) {}
- */
- }
JDK6.0学习笔记(十九)FIP客户端
最新推荐文章于 2024-10-16 17:21:01 发布