01: /*
02: * This program is free software; you can redistribute it and/or
03: * modify it under the terms of the GNU General Public License
04: * as published by the Free Software Foundation; either version 2
05: * of the License, or (at your option) any later version.
06: *
07: * This program is distributed in the hope that it will be useful,
08: * but WITHOUT ANY WARRANTY; without even the implied warranty of
09: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10: * GNU General Public License for more details.
11: *
12: * You should have received a copy of the GNU General Public License
13: * along with this program; if not, write to the Free Software
14: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15: */
16: package net.sf.jftp.net;
17:
18: public class FtpClient {
19: private String name = "ftp";
20: private String password = "ftp@sourceforge.net";
21: private FtpConnection connection = null;
22:
23: public FtpClient() {
24: }
25:
26: public void login(String host) {
27: connection = new FtpConnection(host);
28: connection.login(name, password);
29: }
30:
31: public void setUsername(String s) {
32: name = s;
33: }
34:
35: public void setPassword(String s) {
36: password = s;
37: }
38:
39: public void disconnect() {
40: if (connection != null) {
41: connection.disconnect();
42: }
43: }
44:
45: public void cd(String s) {
46: if (connection != null) {
47: connection.chdir(s);
48: }
49: }
50:
51: public String pwd() {
52: if (connection != null) {
53: return connection.getPWD();
54: } else {
55: return "";
56: }
57: }
58:
59: public void get(String file) {
60: if (connection != null) {
61: connection.handleDownload(file);
62: }
63: }
64:
65: public void put(String file) {
66: if (connection != null) {
67: connection.handleUpload(file);
68: }
69: }
70: }
|