code: public ExecuteResult execute( String command ) throws JSchException, IOException {
          logger.debug( "executing {} on {}", command, sessionManager );
          Session session = sessionManager.getSession();
  
          ByteArrayOutputStream stdErr = new ByteArrayOutputStream();
          ByteArrayOutputStream stdOut = new ByteArrayOutputStream();
          int exitCode;
          ChannelExecWrapper channel = null;
          try {
              channel = new ChannelExecWrapper( session, command, null, stdOut, stdErr );
          }
          finally {
              exitCode = channel.close();
          }
  
          return new ExecuteResult( exitCode,
                  new String( stdOut.toByteArray(), UTF8 ),
                  new String( stdErr.toByteArray(), UTF8 ) );
      }
docs: Executes <code>command</code> and returns the result. Use this method
  when the command you are executing requires no input, writes only UTF-8
  compatible text to STDOUT and/or STDERR, and you are comfortable with
  buffering up all of that data in memory. Otherwise, use
  {@link #open(String)}, which allows you to work with the underlying
  streams.
  
  @param command
  The command to execute
  @return The resulting data
  
  @throws JSchException
  If ssh execution fails
  @throws IOException
  If unable to read the result data