public class SimpleSftpClientImpl extends AbstractLoggingBean implements SimpleSftpClient
Modifier and Type | Field and Description |
---|---|
private SimpleClient |
clientInstance |
private SftpClientFactory |
sftpClientFactory |
log
Constructor and Description |
---|
SimpleSftpClientImpl() |
SimpleSftpClientImpl(SimpleClient client) |
SimpleSftpClientImpl(SimpleClient client,
SftpClientFactory sftpClientFactory) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected SftpClient |
createSftpClient(ClientSession session) |
protected SftpClient |
createSftpClient(ClientSession session,
SftpClient client) |
protected SftpClient |
createSftpClient(IOFunction<? super SimpleClient,? extends ClientSession> sessionProvider) |
SimpleClient |
getClient() |
SftpClientFactory |
getSftpClientFactory() |
boolean |
isOpen() |
void |
setClient(SimpleClient client) |
void |
setSftpClientFactory(SftpClientFactory sftpClientFactory) |
SftpClient |
sftpLogin(java.net.SocketAddress target,
java.lang.String username,
java.security.KeyPair identity)
Creates an SFTP session using the provided credentials
|
SftpClient |
sftpLogin(java.net.SocketAddress target,
java.lang.String username,
java.lang.String password)
Creates an SFTP session using the provided credentials
|
getSimplifiedLogger
private SimpleClient clientInstance
private SftpClientFactory sftpClientFactory
public SimpleSftpClientImpl()
public SimpleSftpClientImpl(SimpleClient client)
public SimpleSftpClientImpl(SimpleClient client, SftpClientFactory sftpClientFactory)
public SimpleClient getClient()
public void setClient(SimpleClient client)
public SftpClientFactory getSftpClientFactory()
public void setSftpClientFactory(SftpClientFactory sftpClientFactory)
public SftpClient sftpLogin(java.net.SocketAddress target, java.lang.String username, java.lang.String password) throws java.io.IOException
SimpleSftpClient
sftpLogin
in interface SimpleSftpClient
target
- The target SocketAddress
username
- Usernamepassword
- PasswordSftpClient
- Note: closing the client also closes its
underlying sessionjava.io.IOException
- If failed to login or authenticatepublic SftpClient sftpLogin(java.net.SocketAddress target, java.lang.String username, java.security.KeyPair identity) throws java.io.IOException
SimpleSftpClient
sftpLogin
in interface SimpleSftpClient
target
- The target SocketAddress
username
- Usernameidentity
- The KeyPair
identitySftpClient
- Note: closing the client also closes its
underlying sessionjava.io.IOException
- If failed to login or authenticateprotected SftpClient createSftpClient(IOFunction<? super SimpleClient,? extends ClientSession> sessionProvider) throws java.io.IOException
java.io.IOException
protected SftpClient createSftpClient(ClientSession session) throws java.io.IOException
java.io.IOException
protected SftpClient createSftpClient(ClientSession session, SftpClient client) throws java.io.IOException
java.io.IOException
public boolean isOpen()
isOpen
in interface java.nio.channels.Channel
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface java.nio.channels.Channel
java.io.IOException