当前位置: 代码迷 >> J2SE >> 关于FTPClient 的有关问题
  详细解决方案

关于FTPClient 的有关问题

热度:56   发布时间:2016-04-23 20:36:52.0
关于FTPClient 的问题
先贴代码



package COM.LZW.FTP.EXTCLASS;
import org.apache.commons.net.ftp.*;
import java.io.IOException;
import COM.LZW.FTP.EXTCLASS.FtpClient;
import sun.net.TelnetInputStream;
import sun.net.TelnetOutputStream;
import sun.net.ftp.*;

public  class FtpClient{
private String server;
private int port;
private String name;
private String pass;

public int getPort() {
return port;
}

public String getName() {
return name;
}

public String getPass() {
return pass;
}

public FtpClient(String server, int port) throws IOException {
this.port=port;
this.server = server;
}

@SuppressWarnings("restriction")
public FtpClient() {
super();
}

public synchronized void binary() throws IOException {
this.binary();
}

@Override
public synchronized void cd(String arg0) throws IOException {
super.cd(arg0);
}

public synchronized void cdUp() throws IOException {
super.cdup();
}

@SuppressWarnings("restriction")
public synchronized TelnetInputStream get(String file) throws IOException {
return super.get(file);
}

@Override
public synchronized TelnetInputStream list() throws IOException {
return super.list();
}

@Override
public synchronized void login(String arg0, String arg1) throws IOException {
name = arg0;
pass = arg1;
super.login(arg0, arg1);
}

@Override
public synchronized void noop() throws IOException {
super.noop();
}

public synchronized void openServer(String arg0, int port)
throws IOException {
this.server = arg0;
this.port = port;
super.openServer(server, port);
}

@Override
public synchronized TelnetOutputStream put(String arg0) throws IOException {
return super.put(arg0);
}

@Override
public synchronized String pwd() throws IOException {
String pwd = super.pwd();
pwd = new String(pwd.getBytes("iso-8859-1"), "GBK");
return pwd;
}

@Override
public synchronized int readServerResponse() throws IOException {
return super.readServerResponse();
}

@Override
public synchronized void sendServer(String command) {
super.sendServer(command);
}

@Override
public synchronized boolean serverIsOpen() {
return super.serverIsOpen();
}

public String getServer() {
return server;
}
}





里面的
public synchronized void cd(String arg0) throws IOException {
super.cd(arg0);
}

public synchronized void cdUp() throws IOException {
super.cdup();
}

@SuppressWarnings("restriction")
public synchronized TelnetInputStream get(String file) throws IOException {
return super.get(file);
}

@Override
public synchronized TelnetInputStream list() throws IOException {
return super.list();
}

@Override
public synchronized void login(String arg0, String arg1) throws IOException {
name = arg0;
pass = arg1;
super.login(arg0, arg1);
}

@Override
public synchronized void noop() throws IOException {
super.noop();
}

public synchronized void openServer(String arg0, int port)
throws IOException {
this.server = arg0;
this.port = port;
super.openServer(server, port);
}

@Override
public synchronized TelnetOutputStream put(String arg0) throws IOException {
return super.put(arg0);
}

@Override
public synchronized String pwd() throws IOException {
String pwd = super.pwd();
pwd = new String(pwd.getBytes("iso-8859-1"), "GBK");
return pwd;
}

@Override
public synchronized int readServerResponse() throws IOException {
return super.readServerResponse();
}

@Override
public synchronized void sendServer(String command) {
super.sendServer(command);
}

@Override
public synchronized boolean serverIsOpen() {
return super.serverIsOpen();
}

这些方法有问题,求高人指点,网上查了一下说引包有问题,但是该引的都引了。方法还是不好使,下面有红线~~
------解决方案--------------------
public  class FtpClient{