public class SftpRunner extends Object implements AutoCloseable
sftp channel. This
implementation offers a simplified interface that manages the resources
needed to issue sftp commands.ChannelSftp| Constructor and Description |
|---|
SftpRunner(ISessionFactory sessionFactory)
Creates a new SftpRunner that will use a
SessionManager that wraps
the supplied sessionFactory. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying
SessionManager. |
void |
execute(ISftp sftp)
Executes the
sftp callback providing it an open
ChannelSftp. |
public SftpRunner(@Nonnull ISessionFactory sessionFactory)
SessionManager that wraps
the supplied sessionFactory.sessionFactory - The factory used to create a session managerpublic void execute(@Nonnull ISftp sftp) throws com.jcraft.jsch.JSchException, IOException
sftp callback providing it an open
ChannelSftp. Sftp callback implementations should NOT close
the channel.sftp - A callbackcom.jcraft.jsch.JSchException - If ssh execution failsIOException - If unable to read the result datapublic void close()
throws IOException
SessionManager.close in interface AutoCloseableIOExceptionSessionManager.close()Copyright © 2020 Philip Helger. All rights reserved.