1 16 package net.sf.jftp.net; 17 18 19 20 public class FtpClient 21 { 22 private String name = "ftp"; 23 private String password = "ftp@sourceforge.net"; 24 private FtpConnection connection = null; 25 26 public FtpClient() 27 { 28 } 29 30 public void login(String host) 31 { 32 connection = new FtpConnection(host); 33 connection.login(name, password); 34 } 35 36 public void setUsername(String s) 37 { 38 name = s; 39 } 40 41 public void setPassword(String s) 42 { 43 password = s; 44 } 45 46 public void disconnect() 47 { 48 if(connection != null) 49 { 50 connection.disconnect(); 51 } 52 } 53 54 public void cd(String s) 55 { 56 if(connection != null) 57 { 58 connection.chdir(s); 59 } 60 } 61 62 public String pwd() 63 { 64 if(connection != null) 65 { 66 return connection.getPWD(); 67 } 68 else 69 { 70 return ""; 71 } 72 } 73 74 public void get(String file) 75 { 76 if(connection != null) 77 { 78 connection.handleDownload(file); 79 } 80 } 81 82 public void put(String file) 83 { 84 if(connection != null) 85 { 86 connection.handleUpload(file); 87 } 88 } 89 } 90 | Popular Tags |