| 限定符和类型 | 字段和说明 |
|---|---|
protected static int |
CLIENT_TIMEOUT |
| 构造器和说明 |
|---|
SFTPUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
delete(String host,
int port,
String username,
String password,
String filePath)
删除文件
|
static boolean |
download(String host,
int port,
String username,
String password,
String filePath,
OutputStream outputStream)
下载文件。
|
static boolean |
isFileExist(String host,
int port,
String username,
String password,
String filePath)
列出目录下的文件
|
static com.jcraft.jsch.ChannelSftp |
login(String host,
int port,
String username,
String password)
连接Sftp服务器
|
static void |
logout(com.jcraft.jsch.ChannelSftp Sftp)
关闭连接 server
|
static boolean |
upload(String host,
int port,
String username,
String password,
String basePath,
String SftpFileName,
InputStream input)
将输入流的数据上传到Sftp作为文件。
|
protected static final int CLIENT_TIMEOUT
public SFTPUtil()
public static com.jcraft.jsch.ChannelSftp login(String host, int port, String username, String password)
public static void logout(com.jcraft.jsch.ChannelSftp Sftp)
public static boolean upload(String host, int port, String username, String password, String basePath, String SftpFileName, InputStream input)
basePath - 服务器的基础路径SftpFileName - Sftp端文件名public static boolean download(String host, int port, String username, String password, String filePath, OutputStream outputStream)
public static boolean delete(String host, int port, String username, String password, String filePath)
public static boolean isFileExist(String host, int port, String username, String password, String filePath)
Copyright © 2024. All rights reserved.