public class SftpRunner
extends java.lang.Object
implements java.io.Closeable
sftp channel. This
implementation offers a simplified interface that manages the resources
needed to issue sftp commands.ChannelSftp| Modifier and Type | Class and Description |
|---|---|
static interface |
SftpRunner.Sftp
A simple callback interface for working with managed sftp channels.
|
| Constructor and Description |
|---|
SftpRunner(SessionFactory 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(SftpRunner.Sftp sftp)
Executes the
sftp callback providing it an open
ChannelSftp. |
public SftpRunner(SessionFactory sessionFactory)
SessionManager that
wraps the supplied sessionFactory.sessionFactory - The factory used to create a session managerpublic void execute(SftpRunner.Sftp sftp) throws com.jcraft.jsch.JSchException, java.io.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 failsjava.io.IOException - If unable to read the result datapublic void close()
throws java.io.IOException
SessionManager.close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionSessionManager.close()Copyright © 2018 pastdev.com. All Rights Reserved.