@Override
    public synchronized Reader executeCommandReader(String command) throws SshException, IOException {
        if (!isConnected()) {
            throw new IllegalStateException("Not connected!");
        }
        try {
            Channel channel = connectSession.openChannel("exec");
            ((ChannelExec)channel).setCommand(command);
            InputStreamReader reader = new InputStreamReader(channel.getInputStream(), "utf-8");
            channel.connect();
            return reader;
        } catch (JSchException ex) {
            throw new SshException(ex);
        }
    }
@ Override public synchronized Reader executeCommandReader ( String command ) throws SshException , IOException { if ( ! isConnected ( ) ) { throw new IllegalStateException ( "Not connected!" ) ; } try { Channel channel = connectSession . openChannel ( "exec" ) ; ( ( ChannelExec ) channel ) . setCommand ( command ) ; InputStreamReader reader = new InputStreamReader ( channel . getInputStream ( ) , "utf-8" ) ; channel . connect ( ) ; return reader ; } catch ( JSchException ex ) { throw new SshException ( ex ) ; } }
Execute an ssh command on the server, without closing the session
so that a Reader can be returned with streaming data from the server.

@param command the command to execute.
@return a Reader with streaming data from the server.
@throws IOException  if it is so.
@throws SshException if there are any ssh problems.