public class FTPHelper
extends java.lang.Object
FTP 帮助器
FTP Helper
Email: fishinlove@163.com
created by 2019/04/02 13:04:59
| 构造器和说明 |
|---|
FTPHelper() |
| 限定符和类型 | 方法和说明 |
|---|---|
static org.apache.commons.net.ftp.FTPClient |
connectToFTP(ServerAddress address,
LoginInfo user)
连接到 FTP 服务器
返回一个 FTPClient 对象
Connect to FTP server
Return a connection to FTP server
|
static void |
disconnectFromFTP(org.apache.commons.net.ftp.FTPClient client)
关闭与 FTP 服务器的连接
Cloase the connection to FTP server
|
static boolean |
upload(FTPUploadFile file,
java.lang.String controlEncoding)
上传一个文件到 FTP 服务器
注意:
这个参数包含很多要被上传文件的属性以及 FTP 服务器的属性
Upload a file to FTP server
Notice:
This argument "file" has many attributes about the file
to be uploaded and info of FTP server
|
static boolean |
uploadAscii(FTPUploadFile file,
java.lang.String controlEncoding)
上传一个文本文件到 FTP 服务器
注意:
这个参数包含很多要被上传文件的属性以及 FTP 服务器的属性
Upload a text file to FTP server
Notice:
This argument "file" has many attributes about the file
to be uploaded and info of FTP server
|
static boolean |
uploadBinary(FTPUploadFile file,
java.lang.String controlEncoding)
上传一个二进制文件到 FTP 服务器
注意:
这个参数包含很多要被上传文件的属性以及 FTP 服务器的属性
Upload a binary file to FTP server
Notice:
This argument "file" has many attributes about the file
to be uploaded and info of FTP server
|
public static boolean upload(FTPUploadFile file, java.lang.String controlEncoding) throws java.io.IOException
上传一个文件到 FTP 服务器
注意: 这个参数包含很多要被上传文件的属性以及 FTP 服务器的属性
Upload a file to FTP server
Notice: This argument "file" has many attributes about the file to be uploaded and info of FTP server
file - 要被上传的文件,这个参数包含很多要被上传文件的属性以及 FTP 服务器的属性
The file to be uploaded, This argument "file" has many attributes about the file to be uploaded and info of FTP server
controlEncoding - 网络通信使用的编码
The encoding of net transport
true 上传成功,false 上传不成功
true if successful, false if not
java.io.IOException - 上传遇到问题就会抛出这个异常
If occur some problems when uploading
FTP.setControlEncoding(String)public static boolean uploadAscii(FTPUploadFile file, java.lang.String controlEncoding) throws java.io.IOException
上传一个文本文件到 FTP 服务器
注意: 这个参数包含很多要被上传文件的属性以及 FTP 服务器的属性
Upload a text file to FTP server
Notice: This argument "file" has many attributes about the file to be uploaded and info of FTP server
file - 要被上传的文本文件,这个参数包含很多要被上传文件的属性以及 FTP 服务器的属性
The text file to be uploaded, This argument "file" has many attributes about the file to be uploaded and info of FTP server
controlEncoding - 网络通信使用的编码
The encoding of net transport
true 上传成功,false 上传不成功
true if successful, false if not
java.io.IOException - 上传遇到问题就会抛出这个异常
If occur some problems when uploading
FTP.setControlEncoding(String)public static boolean uploadBinary(FTPUploadFile file, java.lang.String controlEncoding) throws java.io.IOException
上传一个二进制文件到 FTP 服务器
注意: 这个参数包含很多要被上传文件的属性以及 FTP 服务器的属性
Upload a binary file to FTP server
Notice: This argument "file" has many attributes about the file to be uploaded and info of FTP server
file - 要被上传的二进制文件,这个参数包含很多要被上传文件的属性以及 FTP 服务器的属性
The text file to be uploaded, This argument "file" has many attributes about the file to be uploaded and info of FTP server
controlEncoding - 网络通信使用的编码
The encoding of net transport
true 上传成功,false 上传不成功
true if successful, false if not
java.io.IOException - 上传遇到问题就会抛出这个异常
If occur some problems when uploading
FTP.setControlEncoding(String)public static org.apache.commons.net.ftp.FTPClient connectToFTP(ServerAddress address, LoginInfo user) throws java.io.IOException
连接到 FTP 服务器
返回一个 FTPClient 对象
Connect to FTP server
Return a connection to FTP server
address - 服务器地址
Server address
user - 登录 FTP 服务器的用户
User who login the FTP server
返回一个 FTPClient 对象
Return a connection to FTP server
java.io.IOException - 当连接出现异常的时候就会抛出这个异常
If connect failed
public static void disconnectFromFTP(org.apache.commons.net.ftp.FTPClient client)
关闭与 FTP 服务器的连接
Cloase the connection to FTP server
client - 要被关闭的连接对象
The connection to be closed
Copyright © 2019. All Rights Reserved.