Class SSHShell

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class SSHShell
    extends java.lang.Object
    implements java.io.Closeable
    SSH Shell
    Since:
    1.2
    • Method Summary

      Modifier and Type Method Description
      void close()
      close
      include cmdExitAndJoinEOF();
      void cmd​(java.lang.String... cmds)
      send commend
      void cmdExitAndJoinEOF()
      send commend "exit" and wait EOF

      this method will ignore exceptions
      there is the same next 2 line
      cmd("exit");
      joinEOF();
      boolean isConnected()
      connected
      void joinEOF()
      cmd("exit"); and wait output
      static SSHShell open​(java.lang.String host, int port, java.lang.String user, java.lang.String pass, java.lang.String charset, ThrowableConsumer<java.lang.String> readLines)
      open ssh
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • open

        public static SSHShell open​(java.lang.String host,
                                    int port,
                                    java.lang.String user,
                                    java.lang.String pass,
                                    java.lang.String charset,
                                    ThrowableConsumer<java.lang.String> readLines)
                             throws java.io.IOException
        open ssh
        Parameters:
        host -
        port -
        user -
        pass -
        charset -
        Returns:
        Throws:
        java.io.IOException
      • cmd

        public void cmd​(java.lang.String... cmds)
                 throws java.io.IOException
        send commend
        Parameters:
        cmd -
        Throws:
        java.io.IOException
      • cmdExitAndJoinEOF

        public void cmdExitAndJoinEOF()
                               throws java.io.IOException,
                                      java.lang.InterruptedException
        send commend "exit" and wait EOF

        this method will ignore exceptions
        there is the same next 2 line
        cmd("exit");
        joinEOF();
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • joinEOF

        public void joinEOF()
                     throws java.lang.InterruptedException
        cmd("exit"); and wait output
        Throws:
        java.lang.InterruptedException
      • isConnected

        public boolean isConnected()
        connected
        Returns:
      • close

        public void close()
                   throws java.io.IOException
        close
        include cmdExitAndJoinEOF();
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException