Class SftpCommandMain

All Implemented Interfaces:
Closeable, AutoCloseable, Channel, org.apache.sshd.sftp.client.SftpClientHolder

public class SftpCommandMain extends SshClientCliSupport implements org.apache.sshd.sftp.client.SftpClientHolder, Channel
TODO Add javadoc
  • Field Details

    • SFTP_PORT_OPTION

      public static final String SFTP_PORT_OPTION
      Command line option used to indicate a non-default port number
      See Also:
    • client

      private final org.apache.sshd.sftp.client.SftpClient client
    • commandsMap

      private final Map<String,SftpCommandExecutor> commandsMap
    • cwdRemote

      private String cwdRemote
    • cwdLocal

      private String cwdLocal
    • showProgress

      private boolean showProgress
  • Constructor Details

    • SftpCommandMain

      public SftpCommandMain(org.apache.sshd.sftp.client.SftpClient client)
  • Method Details

    • getClient

      public final org.apache.sshd.sftp.client.SftpClient getClient()
      Specified by:
      getClient in interface org.apache.sshd.sftp.client.SftpClientHolder
    • doInteractive

      public void doInteractive(BufferedReader stdin, PrintStream stdout, PrintStream stderr) throws Exception
      Throws:
      Exception
    • resolveLocalPath

      protected String resolveLocalPath(String pathArg)
    • resolveRemotePath

      protected String resolveRemotePath(String pathArg)
    • appendFileAttributes

      protected <A extends Appendable> A appendFileAttributes(A stdout, org.apache.sshd.sftp.client.SftpClient sftp, String path, org.apache.sshd.sftp.client.SftpClient.Attributes attrs) throws IOException
      Throws:
      IOException
    • getCurrentRemoteDirectory

      public String getCurrentRemoteDirectory()
    • setCurrentRemoteDirectory

      public void setCurrentRemoteDirectory(String path)
    • getCurrentLocalDirectory

      public String getCurrentLocalDirectory()
    • setCurrentLocalDirectory

      public void setCurrentLocalDirectory(String path)
    • isShowProgress

      public boolean isShowProgress()
    • setShowProgress

      public void setShowProgress(boolean showProgress)
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface Channel
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Channel
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • appendInfoValue

      public static <A extends Appendable> A appendInfoValue(A sb, CharSequence name, Object value) throws IOException
      Throws:
      IOException
    • resolveSftpClientFactory

      public static org.apache.sshd.sftp.client.SftpClientFactory resolveSftpClientFactory(org.apache.sshd.client.session.ClientSession session)
    • resolveVersionSelector

      public static org.apache.sshd.sftp.client.SftpVersionSelector.NamedVersionSelector resolveVersionSelector(org.apache.sshd.client.session.ClientSession session)
    • resolveErrorDataHandlerStream

      private static OutputStream resolveErrorDataHandlerStream(org.apache.sshd.client.session.ClientSession session, org.slf4j.Logger logger)
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception