FtpClient工具类
| Type | Name and description |
|---|---|
static org.apache.commons.net.ftp.FTPClient |
connect(String host, Integer port = 21, String username = "anonymous", String password = "anonymous@bropen.com.cn")连接并登录FTP服务器。 |
static void |
disconnect(org.apache.commons.net.ftp.FTPClient ftp)断开FTP连接 |
static boolean |
get(org.apache.commons.net.ftp.FTPClient ftp, String remotePath, String localPath)下载文件。 |
static boolean |
put(org.apache.commons.net.ftp.FTPClient ftp, String remotePath, String localFile)上传文件,如果文件已存在,则自动覆盖。 |
| Methods inherited from class | Name |
|---|---|
class Object |
Object#wait(long, int), Object#wait(long), Object#wait(), Object#equals(Object), Object#toString(), Object#hashCode(), Object#getClass(), Object#notify(), Object#notifyAll() |
连接并登录FTP服务器。
注:
client.setBufferSize ( 512000 )。断开FTP连接
下载文件。如果本地文件已存在,则自动覆盖。
remotePath - 远程文件名全路径,如 “/foo/bar.doc”localPath - 本地文件名全路径,或文件夹(以"/"或"\\"结尾)上传文件,如果文件已存在,则自动覆盖。
remotePath - 远程文件夹(以“/”结尾)或文件名的全路径localFile - 本地文件名全路径