实现
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply;
import com.ctid.core.exception.ServiceException;
import com.ctid.mainlib.system.util.datehandle.PathHandler;
public class FtpHandle implements AutoCloseable{
private static final Log Log = LogFactory.getLog(FtpHandle.class);
private FTPClient ftpClient;
public FtpHandle(String host, int port, String username, String password, int timeout) throws Exception {
super();
this.ftpClient = new FTPClient();
this.ftpClient.setBufferSize(8192);
this.ftpClient.setConnectTimeout(timeout);
this.ftpClient.connect(host, port);
this.ftpClient.setDataTimeout(timeout);
this.ftpClient.setSoTimeout(timeout);
if(!FTPReply.isPositiveCompletion(this.ftpClient.getReplyCode())){
this.ftpClient.disconnect();
throw new ServiceException(