public abstract class SshClientUtils extends Object
| 构造器和说明 |
|---|
SshClientUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
download(ch.ethz.ssh2.Connection connection,
String path)
SFTP下载文件
|
static String |
execute(ch.ethz.ssh2.Connection connection,
String command)
执行SSH命令
|
static ch.ethz.ssh2.Connection |
getConnection(String host,
int port,
String username)
获取Connection
|
static ch.ethz.ssh2.Connection |
getConnection(String host,
int port,
String username,
String password)
获取Connection
|
static ch.ethz.ssh2.Connection |
getConnection(String host,
String username)
获取Connection,端口(默认:22)
|
static ch.ethz.ssh2.Connection |
getConnection(String host,
String username,
String password)
获取Connection,端口(默认:22)
|
static List<String> |
listNames(ch.ethz.ssh2.Connection connection,
String path)
SFTP名称列表
|
static void |
upLoad(ch.ethz.ssh2.Connection connection,
byte[] input,
String path)
SFTP上传文件
|
static void |
upLoad(ch.ethz.ssh2.Connection connection,
File file,
String path)
SFTP上传文件
|
static void |
upLoad(ch.ethz.ssh2.Connection connection,
InputStream input,
String path)
SFTP上传文件
|
public static ch.ethz.ssh2.Connection getConnection(String host, String username)
host - 主机username - 登录名称public static ch.ethz.ssh2.Connection getConnection(String host, int port, String username)
host - 主机port - 端口username - 登录名称public static ch.ethz.ssh2.Connection getConnection(String host, String username, String password)
host - 主机username - 登录名称password - 登录密码public static ch.ethz.ssh2.Connection getConnection(String host, int port, String username, String password)
host - 主机port - 端口username - 登录名称password - 登录密码public static String execute(ch.ethz.ssh2.Connection connection, String command)
connection - SSH连接command - SSH命令public static void upLoad(ch.ethz.ssh2.Connection connection,
File file,
String path)
connection - SSH连接file - 文件path - 远程路径public static void upLoad(ch.ethz.ssh2.Connection connection,
byte[] input,
String path)
connection - SSH连接input - 文件流path - 远程路径public static void upLoad(ch.ethz.ssh2.Connection connection,
InputStream input,
String path)
connection - SSH连接input - 文件流path - 远程路径public static byte[] download(ch.ethz.ssh2.Connection connection,
String path)
connection - SSH连接path - 远程路径Copyright © 2019. All rights reserved.