public class FtpUtil
extends java.lang.Object
| 构造器和说明 |
|---|
FtpUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
closeConnection(YokeFtp ftpClient)
关闭连接,使用完连接之后,一定要关闭连接,否则服务器会抛出 Connection reset by peer的错误
|
static void |
closeConnection(YokeFtp[] ftpClients)
关闭连接,使用完连接之后,一定要关闭连接,否则服务器会抛出 Connection reset by peer的错误
|
static boolean |
deleteFile(org.apache.commons.net.ftp.FTPClient ftp,
java.lang.String path)
删除文件-FTP方式
|
static boolean |
FtpUpload(YokeFtp ftp,
java.lang.String rootPath,
boolean containName)
ftp 上传文件夹 到根路径
|
static boolean |
FtpUpload(YokeFtp ftp,
java.lang.String fileName,
java.lang.String remotePath)
ftp 上传文件 文件名为本地文件名
|
static boolean |
FtpUpload(YokeFtp ftp,
java.lang.String rootPath,
java.lang.String remotePath,
boolean containName)
上传文件 到指定文件夹下
|
static boolean |
FtpUpload(YokeFtp ftp,
java.lang.String fileName,
java.lang.String rootPath,
java.lang.String remotePath)
ftp 发布单个文件
|
static YokeFtp |
getFtpClient(FtpInfo ftpInfo)
获取ftp 连接对象
|
static org.apache.commons.net.ftp.FTPClient |
getFtpClient(java.lang.String server,
int port,
java.lang.String username,
java.lang.String password,
java.lang.String encoding,
int mode)
创建ftp 连接对象
|
static boolean |
removeDirectoryALLFile(org.apache.commons.net.ftp.FTPClient ftp,
java.lang.String pathName)
ftp删除文件及文件夹
|
static boolean |
togetherUploadFolder(YokeFtp ftpClient,
java.lang.String localPath,
java.lang.String remotePath,
int tryCount)
发送文件到Ftp
|
static boolean |
uploadFile(YokeFtp ftp,
java.io.File file,
java.lang.String remotePath)
ftp 上传文件 文件名为本地文件名
|
static boolean |
uploadFile(YokeFtp ftp,
java.io.File file,
java.lang.String remotePath,
java.lang.String remoteName)
ftp 上传单个文件 文件名为指定 如没有指定则默认为本地文件名
|
static boolean |
uploadFolder(YokeFtp ftp,
java.lang.String rootPath)
ftp 上传文件夹
|
public static org.apache.commons.net.ftp.FTPClient getFtpClient(java.lang.String server,
int port,
java.lang.String username,
java.lang.String password,
java.lang.String encoding,
int mode)
throws java.io.IOException
server - sport - pusername - uencoding - epassword - pmode - modejava.net.SocketException - sjava.io.IOException - iopublic static YokeFtp getFtpClient(FtpInfo ftpInfo) throws java.io.IOException
ftpInfo - ftpjava.io.IOException - iopublic static boolean togetherUploadFolder(YokeFtp ftpClient, java.lang.String localPath, java.lang.String remotePath, int tryCount) throws java.io.IOException
ftpClient - clientlocalPath - 本地文件目录remotePath - 远程文件截取目录tryCount - tryCountjava.io.IOException - iopublic static boolean FtpUpload(YokeFtp ftp, java.lang.String fileName, java.lang.String remotePath) throws java.io.IOException
ftp - ftpfileName - nameremotePath - pathjava.io.IOException - iopublic static boolean FtpUpload(YokeFtp ftp, java.lang.String fileName, java.lang.String rootPath, java.lang.String remotePath) throws java.io.IOException
ftp - ftpfileName - namerootPath - pathremotePath - pathjava.io.IOException - iopublic static boolean uploadFile(YokeFtp ftp, java.io.File file, java.lang.String remotePath) throws java.io.IOException
ftp - ftpfile - fileremotePath - remotePathjava.io.IOException - iopublic static boolean uploadFile(YokeFtp ftp, java.io.File file, java.lang.String remotePath, java.lang.String remoteName) throws java.io.IOException
ftp - ftpfile - 文件对象remotePath - ftp 文件路径remoteName - ftp 文件名 默认为本地文件名java.io.IOException - iopublic static boolean uploadFolder(YokeFtp ftp, java.lang.String rootPath) throws java.io.IOException
ftp - ftprootPath - rootPathjava.io.IOException - iopublic static boolean FtpUpload(YokeFtp ftp, java.lang.String rootPath, java.lang.String remotePath, boolean containName) throws java.io.IOException
ftp - ftprootPath - rootPathremotePath - pathcontainName - 是否包含文件夹名java.io.IOException - iopublic static boolean FtpUpload(YokeFtp ftp, java.lang.String rootPath, boolean containName) throws java.io.IOException
ftp - ftprootPath - pathcontainName - namejava.io.IOException - iopublic static boolean removeDirectoryALLFile(org.apache.commons.net.ftp.FTPClient ftp,
java.lang.String pathName)
throws java.io.IOException
ftp - ftppathName - pathNamejava.io.IOException - iopublic static boolean deleteFile(org.apache.commons.net.ftp.FTPClient ftp,
java.lang.String path)
throws java.io.IOException
ftp - FTPClient对象path - FTP服务器上传地址java.io.IOException - iopublic static void closeConnection(YokeFtp ftpClient)
ftpClient - ftppublic static void closeConnection(YokeFtp[] ftpClients)
ftpClients - ftpCopyright © 2017. All Rights Reserved.