public class SshClient
extends java.lang.Object
implements java.io.Closeable
| Modifier and Type | Field and Description |
|---|---|
static int |
EXIT_CODE_NOT_RECEIVED |
| Constructor and Description |
|---|
SshClient(SshConnection con) |
SshClient(SshConnection con,
boolean closeConnection) |
SshClient(java.lang.String hostname,
java.lang.Integer port,
java.lang.String username) |
SshClient(java.lang.String hostname,
java.lang.Integer port,
java.lang.String username,
char[] password,
java.io.File key,
java.lang.String passphrase) |
SshClient(java.lang.String hostname,
java.lang.Integer port,
java.lang.String username,
long connectTimeout) |
SshClient(java.lang.String hostname,
java.lang.Integer port,
java.lang.String username,
long connectTimeout,
char[] password,
java.io.File key,
java.lang.String passphrase) |
SshClient(java.lang.String hostname,
java.lang.Integer port,
java.lang.String username,
SshClientContext sshContext) |
SshClient(java.lang.String hostname,
java.lang.Integer port,
java.lang.String username,
SshClientContext sshContext,
long connectTimeout) |
SshClient(java.lang.String hostname,
int port,
java.lang.String username,
char[] password) |
SshClient(java.lang.String hostname,
int port,
java.lang.String username,
char[] password,
SshKeyPair... identities) |
SshClient(java.lang.String hostname,
int port,
java.lang.String username,
java.io.File key) |
SshClient(java.lang.String hostname,
int port,
java.lang.String username,
java.io.File key,
java.lang.String passphrase) |
SshClient(java.lang.String hostname,
int port,
java.lang.String username,
long connectTimeout,
char[] password) |
SshClient(java.lang.String hostname,
int port,
java.lang.String username,
long connectTimeout,
char[] password,
SshKeyPair... identities) |
SshClient(java.lang.String hostname,
int port,
java.lang.String username,
long connectTimeout,
java.io.File key) |
SshClient(java.lang.String hostname,
int port,
java.lang.String username,
long connectTimeout,
java.io.File key,
java.lang.String passphrase) |
SshClient(java.lang.String hostname,
int port,
java.lang.String username,
long connectTimeout,
SshKeyPair... identities) |
SshClient(java.lang.String hostname,
int port,
java.lang.String username,
SshClientContext sshContext,
long connectTimeout,
char[] password,
SshKeyPair... identities) |
SshClient(java.lang.String hostname,
int port,
java.lang.String username,
SshClientContext sshContext,
long connectTimeout,
SshKeyPair... identities) |
SshClient(java.lang.String hostname,
int port,
java.lang.String username,
SshClientContext sshContext,
SshKeyPair... identities) |
SshClient(java.lang.String hostname,
int port,
java.lang.String username,
SshKeyPair... identities) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTask(Task task) |
boolean |
authenticate(ClientAuthenticator authenticator,
long timeout) |
void |
close() |
protected void |
configure(SshClientContext sshContext) |
void |
disconnect() |
protected void |
doConnect(java.lang.String hostname,
int port,
java.lang.String username,
SshClientContext sshContext,
long connectTimeout) |
protected <T extends Task> |
doTask(T task,
long timeout) |
java.lang.String |
executeCommand(java.lang.String cmd) |
java.lang.String |
executeCommand(java.lang.String cmd,
long timeout) |
java.lang.String |
executeCommand(java.lang.String cmd,
long timeout,
java.lang.String charset) |
java.lang.String |
executeCommand(java.lang.String cmd,
java.lang.String charset) |
int |
executeCommandWithResult(java.lang.String cmd) |
int |
executeCommandWithResult(java.lang.String cmd,
java.lang.StringBuffer buffer) |
int |
executeCommandWithResult(java.lang.String cmd,
java.lang.StringBuffer buffer,
long timeout) |
int |
executeCommandWithResult(java.lang.String cmd,
java.lang.StringBuffer buffer,
long timeout,
java.lang.String charset) |
int |
executeCommandWithResult(java.lang.String cmd,
java.lang.StringBuffer buffer,
java.lang.String charset) |
java.util.Set<java.lang.String> |
getAuthenticationMethods() |
Connection<SshClientContext> |
getConnection() |
SshClientContext |
getContext() |
java.io.File |
getFile(java.lang.String path) |
void |
getFile(java.lang.String path,
java.io.File destination) |
void |
getFile(java.lang.String path,
java.io.File destination,
long timeout) |
java.io.File |
getFile(java.lang.String path,
long timeout) |
ForwardingPolicy |
getForwardingPolicy() |
java.lang.String |
getHost() |
SshPublicKey |
getHostKey() |
java.lang.String |
getLocalIdentification() |
java.lang.String |
getRemoteIdentification() |
java.lang.String[] |
getRemotePublicKeys() |
boolean |
isAuthenticated() |
boolean |
isConnected() |
SessionChannelNG |
openSessionChannel() |
SessionChannelNG |
openSessionChannel(boolean autoConsume) |
SessionChannelNG |
openSessionChannel(long timeout) |
SessionChannelNG |
openSessionChannel(long timeout,
boolean autoConsume) |
void |
putFile(java.io.File file) |
void |
putFile(java.io.File file,
java.lang.String path) |
void |
putFile(java.io.File file,
java.lang.String path,
long timeout) |
<T extends Task> |
runTask(T task) |
<T extends Task> |
runTask(T task,
long timeout) |
int |
startLocalForwarding(java.lang.String addressToBind,
int portToBind,
java.lang.String destinationHost,
int destinationPort) |
int |
startRemoteForwarding(java.lang.String addressToBind,
int portToBind,
java.lang.String destinationHost,
int destinationPort) |
void |
stopLocalForwarding() |
void |
stopLocalForwarding(java.lang.String addressToBind,
int portToBind) |
void |
stopRemoteForwarding() |
void |
stopRemoteForwarding(java.lang.String addressToBind,
int portToBind) |
public static final int EXIT_CODE_NOT_RECEIVED
public SshClient(java.lang.String hostname,
int port,
java.lang.String username,
long connectTimeout,
char[] password)
throws java.io.IOException,
SshException
java.io.IOExceptionSshExceptionpublic SshClient(java.lang.String hostname,
int port,
java.lang.String username,
char[] password)
throws java.io.IOException,
SshException
java.io.IOExceptionSshExceptionpublic SshClient(java.lang.String hostname,
int port,
java.lang.String username,
long connectTimeout,
java.io.File key)
throws java.io.IOException,
SshException,
InvalidPassphraseException
java.io.IOExceptionSshExceptionInvalidPassphraseExceptionpublic SshClient(java.lang.String hostname,
int port,
java.lang.String username,
java.io.File key)
throws java.io.IOException,
SshException,
InvalidPassphraseException
java.io.IOExceptionSshExceptionInvalidPassphraseExceptionpublic SshClient(java.lang.String hostname,
int port,
java.lang.String username,
long connectTimeout,
java.io.File key,
java.lang.String passphrase)
throws java.io.IOException,
SshException,
InvalidPassphraseException
java.io.IOExceptionSshExceptionInvalidPassphraseExceptionpublic SshClient(java.lang.String hostname,
int port,
java.lang.String username,
java.io.File key,
java.lang.String passphrase)
throws java.io.IOException,
SshException,
InvalidPassphraseException
java.io.IOExceptionSshExceptionInvalidPassphraseExceptionpublic SshClient(java.lang.String hostname,
int port,
java.lang.String username,
long connectTimeout,
SshKeyPair... identities)
throws java.io.IOException,
SshException,
InvalidPassphraseException
java.io.IOExceptionSshExceptionInvalidPassphraseExceptionpublic SshClient(java.lang.String hostname,
int port,
java.lang.String username,
SshKeyPair... identities)
throws java.io.IOException,
SshException,
InvalidPassphraseException
java.io.IOExceptionSshExceptionInvalidPassphraseExceptionpublic SshClient(java.lang.String hostname,
int port,
java.lang.String username,
SshClientContext sshContext,
long connectTimeout,
SshKeyPair... identities)
throws java.io.IOException,
SshException
java.io.IOExceptionSshExceptionpublic SshClient(java.lang.String hostname,
int port,
java.lang.String username,
SshClientContext sshContext,
SshKeyPair... identities)
throws java.io.IOException,
SshException
java.io.IOExceptionSshExceptionpublic SshClient(java.lang.String hostname,
int port,
java.lang.String username,
long connectTimeout,
char[] password,
SshKeyPair... identities)
throws java.io.IOException,
SshException
java.io.IOExceptionSshExceptionpublic SshClient(java.lang.String hostname,
int port,
java.lang.String username,
char[] password,
SshKeyPair... identities)
throws java.io.IOException,
SshException
java.io.IOExceptionSshExceptionpublic SshClient(java.lang.String hostname,
java.lang.Integer port,
java.lang.String username,
long connectTimeout,
char[] password,
java.io.File key,
java.lang.String passphrase)
throws java.io.IOException,
SshException,
InvalidPassphraseException
java.io.IOExceptionSshExceptionInvalidPassphraseExceptionpublic SshClient(java.lang.String hostname,
java.lang.Integer port,
java.lang.String username,
char[] password,
java.io.File key,
java.lang.String passphrase)
throws java.io.IOException,
SshException,
InvalidPassphraseException
java.io.IOExceptionSshExceptionInvalidPassphraseExceptionpublic SshClient(java.lang.String hostname,
java.lang.Integer port,
java.lang.String username,
long connectTimeout)
throws java.io.IOException,
SshException
java.io.IOExceptionSshExceptionpublic SshClient(java.lang.String hostname,
java.lang.Integer port,
java.lang.String username)
throws java.io.IOException,
SshException
java.io.IOExceptionSshExceptionpublic SshClient(java.lang.String hostname,
java.lang.Integer port,
java.lang.String username,
SshClientContext sshContext,
long connectTimeout)
throws java.io.IOException,
SshException
java.io.IOExceptionSshExceptionpublic SshClient(java.lang.String hostname,
java.lang.Integer port,
java.lang.String username,
SshClientContext sshContext)
throws java.io.IOException,
SshException
java.io.IOExceptionSshExceptionpublic SshClient(SshConnection con)
public SshClient(SshConnection con, boolean closeConnection)
public SshClient(java.lang.String hostname,
int port,
java.lang.String username,
SshClientContext sshContext,
long connectTimeout,
char[] password,
SshKeyPair... identities)
throws java.io.IOException,
SshException
java.io.IOExceptionSshExceptionprotected void doConnect(java.lang.String hostname,
int port,
java.lang.String username,
SshClientContext sshContext,
long connectTimeout)
throws SshException,
java.io.IOException
SshExceptionjava.io.IOExceptionprotected void configure(SshClientContext sshContext) throws SshException, java.io.IOException
SshExceptionjava.io.IOExceptionpublic void addTask(Task task) throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic SshClientContext getContext()
public Connection<SshClientContext> getConnection()
public ForwardingPolicy getForwardingPolicy()
public int startLocalForwarding(java.lang.String addressToBind,
int portToBind,
java.lang.String destinationHost,
int destinationPort)
throws UnauthorizedException,
SshException
UnauthorizedExceptionSshExceptionpublic void stopLocalForwarding(java.lang.String addressToBind,
int portToBind)
public void stopLocalForwarding()
public int startRemoteForwarding(java.lang.String addressToBind,
int portToBind,
java.lang.String destinationHost,
int destinationPort)
throws SshException
SshExceptionpublic void stopRemoteForwarding(java.lang.String addressToBind,
int portToBind)
throws SshException
SshExceptionpublic void stopRemoteForwarding()
public boolean isConnected()
public void disconnect()
protected <T extends Task> T doTask(T task, long timeout) throws java.io.IOException
java.io.IOExceptionpublic java.io.File getFile(java.lang.String path)
throws java.io.IOException
java.io.IOExceptionpublic java.io.File getFile(java.lang.String path,
long timeout)
throws java.io.IOException
java.io.IOExceptionpublic void getFile(java.lang.String path,
java.io.File destination)
throws java.io.IOException
java.io.IOExceptionpublic void getFile(java.lang.String path,
java.io.File destination,
long timeout)
throws java.io.IOException
java.io.IOExceptionpublic void putFile(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic void putFile(java.io.File file,
java.lang.String path)
throws java.io.IOException
java.io.IOExceptionpublic void putFile(java.io.File file,
java.lang.String path,
long timeout)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String executeCommand(java.lang.String cmd)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String executeCommand(java.lang.String cmd,
long timeout)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String executeCommand(java.lang.String cmd,
java.lang.String charset)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String executeCommand(java.lang.String cmd,
long timeout,
java.lang.String charset)
throws java.io.IOException
java.io.IOExceptionpublic int executeCommandWithResult(java.lang.String cmd,
java.lang.StringBuffer buffer)
throws java.io.IOException
java.io.IOExceptionpublic int executeCommandWithResult(java.lang.String cmd)
throws java.io.IOException
java.io.IOExceptionpublic int executeCommandWithResult(java.lang.String cmd,
java.lang.StringBuffer buffer,
long timeout)
throws java.io.IOException
java.io.IOExceptionpublic int executeCommandWithResult(java.lang.String cmd,
java.lang.StringBuffer buffer,
java.lang.String charset)
throws java.io.IOException
java.io.IOExceptionpublic int executeCommandWithResult(java.lang.String cmd,
java.lang.StringBuffer buffer,
long timeout,
java.lang.String charset)
throws java.io.IOException
java.io.IOExceptionpublic java.util.Set<java.lang.String> getAuthenticationMethods()
public boolean authenticate(ClientAuthenticator authenticator, long timeout) throws java.io.IOException, SshException
java.io.IOExceptionSshExceptionpublic boolean isAuthenticated()
public <T extends Task> void runTask(T task, long timeout) throws java.io.IOException
java.io.IOExceptionpublic <T extends Task> void runTask(T task) throws java.io.IOException
java.io.IOExceptionpublic java.lang.String[] getRemotePublicKeys()
public java.lang.String getRemoteIdentification()
public java.lang.String getLocalIdentification()
public java.lang.String getHost()
public SshPublicKey getHostKey()
public SessionChannelNG openSessionChannel() throws SshException
SshExceptionpublic SessionChannelNG openSessionChannel(long timeout) throws SshException
SshExceptionpublic SessionChannelNG openSessionChannel(boolean autoConsume) throws SshException
SshExceptionpublic SessionChannelNG openSessionChannel(long timeout, boolean autoConsume) throws SshException
SshExceptionCopyright © 2022. All rights reserved.