java ftp下载
//创建ftp对象FTPClient client = new FTPClient();
client.setDataTimeout(FTP_CONNECTION_TIMEOUT);
client.setControlEncoding(charSet);
//登录ftp
client.connect(host, port);
client.login(account, password);
//下载到本地的文件路径
FileOutputStream fos = new FileOutputStream(localFilePath);
//设置下载文件类型
client.setFileType(FTPClient.BINARY_FILE_TYPE);
//开始下载
client.retrieveFile(RemoteFilePath, fos);
//退出登录ftp
client.logout();
client.disconnect();
client = null;
OK
页:
[1]