public class Ssh extends Object
| Constructor and Description |
|---|
Ssh(String host,
String user,
String password) |
Ssh(String host,
String user,
String password,
int port) |
Ssh(String host,
String user,
String password,
int port,
String forwardHost,
String forwardUser,
String forwardPassword,
int forwardPort) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
String |
downloadFile(String remoteFile) |
void |
downloadFile(String remoteFile,
File localFile)
Download remote file to local file via scp
|
String |
downloadFileIntoString(String remoteFile) |
SshResult |
executeCommand(String command) |
SshResult |
executeCommand(String command,
int timeout)
Execute one command and wait for the result to return
|
protected void |
finalize() |
void |
forward(int local_port,
String host_to_connect,
int port_to_connect) |
String |
getHost() |
String |
getPassword() |
int |
getPort() |
String |
getUsername() |
void |
setHost(String host) |
void |
setPassword(String password) |
void |
setPort(int port) |
void |
setUsername(String username) |
void |
uploadFile(File localFile,
String remoteFile)
Download remote file to local file via scp
|
void |
uploadStringToFile(String string,
String remoteFile)
Upload string to remote file.
|
void |
uploadStringToFile(String string,
String remoteFile,
String remoteDir)
Upload a string using scp, with seperate directory and file parameters.
|
public Ssh(String host, String user, String password) throws IOException
IOExceptionpublic Ssh(String host, String user, String password, int port) throws IOException
IOExceptionpublic Ssh(String host, String user, String password, int port, String forwardHost, String forwardUser, String forwardPassword, int forwardPort) throws IOException
IOExceptionpublic void forward(int local_port,
String host_to_connect,
int port_to_connect)
throws IOException
IOExceptionpublic SshResult executeCommand(String command) throws IOException
IOExceptionpublic SshResult executeCommand(String command, int timeout) throws IOException
IOExceptionpublic void close()
public void uploadFile(File localFile, String remoteFile) throws IOException
IOExceptionpublic void uploadStringToFile(String string, String remoteFile) throws IOException
string - to uploadremoteFile - full path including directoriesIOExceptionpublic void uploadStringToFile(String string, String remoteFile, String remoteDir) throws IOException
string - to uploadremoteFile - only the file nameremoteDir - path to the directoryIOExceptionpublic void downloadFile(String remoteFile, File localFile) throws IOException
remoteFile - localFile - IOExceptionpublic String downloadFileIntoString(String remoteFile) throws IOException
IOExceptionpublic String getHost()
public void setHost(String host)
public String getUsername()
public void setUsername(String username)
public String getPassword()
public void setPassword(String password)
public int getPort()
public void setPort(int port)
public String downloadFile(String remoteFile) throws IOException
IOExceptionCopyright © 2015. All Rights Reserved.