src/java/fr/jayasoft/ivy/repository/ssh/SshRepository.java
/**
     * Reads out the output of a ssh session exec
     * @param channel Channel to read from
     * @param strStdout StringBuffer that receives Session Stdout output
     * @param strStderr StringBuffer that receives Session Stderr output
     * @throws IOException in case of trouble with the network
     */
Reads out the output of a ssh session exec
@param channel Channel to read from
@param strStdout StringBuffer that receives Session Stdout output
@param strStderr StringBuffer that receives Session Stderr output
@throws IOException in case of trouble with the network
Reads out the output of a ssh session exec @param channel Channel to read from @param strStdout StringBuffer that receives Session Stdout output @param strStderr StringBuffer that receives Session Stderr output @throws IOException in case of trouble with the network
private void readSessionOutput(ChannelExec channel, StringBuffer strStdout, StringBuffer strStderr) throws IOException {
        InputStream stdout = channel.getInputStream();
        InputStream stderr = channel.getErrStream();
        try {
            channel.connect();
        } catch (JSchException e1) {
            throw (IOException) new IOException("Channel connection problems").initCause(e1);
        }
        byte[] buffer = new byte[8192];
        while(true){
            int avail = 0;
            while ((avail = stdout.available()) > 0) {
                int len = stdout.read(buffer,0,(avail > 8191 ? 8192 : avail));
                strStdout.append(new String(buffer,0,len));
            }
            while ((avail = stderr.available()) > 0) {
                int len = stderr.read(buffer,0,(avail > 8191 ? 8192 : avail));
                strStderr.append(new String(buffer, 0, len));
            }
            if(channel.isClosed()){
                break;
            }
            try{Thread.sleep(POLL_SLEEP_TIME);}catch(Exception ee){}
        }
        int avail = 0;
        while ((avail = stdout.available()) > 0) {
            int len = stdout.read(buffer,0,(avail > 8191 ? 8192 : avail));
            strStdout.append(new String(buffer,0,len));
        }
        while ((avail = stderr.available()) > 0) {
            int len = stderr.read(buffer,0,(avail > 8191 ? 8192 : avail));
            strStderr.append(new String(buffer, 0, len));
        }
    }
private void readSessionOutput ( ChannelExec channel , StringBuffer strStdout , StringBuffer strStderr ) throws IOException { InputStream stdout = channel . getInputStream ( ) ; InputStream stderr = channel . getErrStream ( ) ; try { channel . connect ( ) ; } catch ( JSchException e1 ) { throw ( IOException ) new IOException ( "Channel connection problems" ) . initCause ( e1 ) ; } byte [ ] buffer = new byte [ 8192 ] ; while ( true ) { int avail = 0 ; while ( ( avail = stdout . available ( ) ) > 0 ) { int len = stdout . read ( buffer , 0 , ( avail > 8191 ? 8192 : avail ) ) ; strStdout . append ( new String ( buffer , 0 , len ) ) ; } while ( ( avail = stderr . available ( ) ) > 0 ) { int len = stderr . read ( buffer , 0 , ( avail > 8191 ? 8192 : avail ) ) ; strStderr . append ( new String ( buffer , 0 , len ) ) ; } if ( channel . isClosed ( ) ) { break ; } try { Thread . sleep ( POLL_SLEEP_TIME ) ; } catch ( Exception ee ) { } } int avail = 0 ; while ( ( avail = stdout . available ( ) ) > 0 ) { int len = stdout . read ( buffer , 0 , ( avail > 8191 ? 8192 : avail ) ) ; strStdout . append ( new String ( buffer , 0 , len ) ) ; } while ( ( avail = stderr . available ( ) ) > 0 ) { int len = stderr . read ( buffer , 0 , ( avail > 8191 ? 8192 : avail ) ) ; strStderr . append ( new String ( buffer , 0 , len ) ) ; } }
Reads out the output of a ssh session exec
 @param channel Channel to read from
 @param strStdout StringBuffer that receives Session Stdout output
 @param strStderr StringBuffer that receives Session Stderr output
 @throws IOException in case of trouble with the network
Reads out the output of a ssh session exec @param channel Channel to read from @param strStdout StringBuffer that receives Session Stdout output @param strStderr StringBuffer that receives Session Stderr output @throws IOException in case of trouble with the network