类 FtpClientHelper
- java.lang.Object
-
- net.risesoft.y9public.ftp.FtpClientHelper
-
public class FtpClientHelper extends Object
-
-
构造器概要
构造器 构造器 说明 FtpClientHelper()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 booleandeleteFile(String pathname)删除文件 单个 ,不可递归booleanmakeDirectories(org.apache.commons.net.ftp.FTPClient client, String dirPath)Creates a nested directory structure on a FTP serverbooleanmakeDirectory(org.apache.commons.net.ftp.FTPClient client, String pathname)创建目录 单个不可递归booleanremoveDirectory(String pathname)删除目录,单个不可递归byte[]retrieveFileBytes(String remote)下载remote文件字节booleanretrieveFileStream(String remote, OutputStream local)voidsetFtpClientPool(FtpClientPool ftpClientPool)booleanstoreFile(String fullPath, String realFileName, byte[] bytes)booleanstoreFile(String fullPath, String realFileName, InputStream local)上传文件
-
-
-
方法详细资料
-
deleteFile
public boolean deleteFile(String pathname) throws Exception
删除文件 单个 ,不可递归- 参数:
pathname- 带路径的文件名称- 返回:
- boolean 删除状态
- 抛出:
Exception- error occurs.
-
makeDirectories
public boolean makeDirectories(org.apache.commons.net.ftp.FTPClient client, String dirPath) throws ExceptionCreates a nested directory structure on a FTP server- 参数:
client- object instance from the pooldirPath- Path of the directory, i.e /projects/java/ftp/demo- 返回:
- boolean true if the directory was created successfully, false otherwise
- 抛出:
Exception- – error occurs.
-
makeDirectory
public boolean makeDirectory(org.apache.commons.net.ftp.FTPClient client, String pathname) throws Exception创建目录 单个不可递归- 参数:
client- object instance from the poolpathname- 目录名称- 返回:
- boolean true if the directory was created successfully, false otherwise
- 抛出:
Exception- error occurs.
-
removeDirectory
public boolean removeDirectory(String pathname) throws Exception
删除目录,单个不可递归- 参数:
pathname- 目录名称- 返回:
- boolean true if the File is remove successfully, false otherwise
- 抛出:
IOException- error occurs.Exception
-
retrieveFileBytes
public byte[] retrieveFileBytes(String remote) throws Exception
下载remote文件字节- 参数:
remote- 远程文件- 返回:
- 字节数据
- 抛出:
Exception- error occurs.
-
retrieveFileStream
public boolean retrieveFileStream(String remote, OutputStream local) throws Exception
- 抛出:
Exception
-
setFtpClientPool
public void setFtpClientPool(FtpClientPool ftpClientPool)
-
storeFile
public boolean storeFile(String fullPath, String realFileName, byte[] bytes) throws Exception
- 抛出:
Exception
-
storeFile
public boolean storeFile(String fullPath, String realFileName, InputStream local) throws Exception
上传文件- 参数:
fullPath- 路径realFileName- 真实文件名称local- 文件流- 返回:
- boolean true if the File was upload successfully, false otherwise
- 抛出:
Exception- error occurs.
-
-