日期:2014-05-17 浏览次数:20662 次
package com.friendone.broadband.util;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.IOUtils;
import com.friendone.broadband.domain.ExecInfo;
import ch.ethz.ssh2.ChannelCondition;
import ch.ethz.ssh2.Connection;
import ch.ethz.ssh2.Session;
import ch.ethz.ssh2.StreamGobbler;
public class SshConnect {
private Connection conn;
/** */ /** 远程机器IP */
private String ip;
/** */ /** 用户名 */
private String usr;
/** */ /** 密码 */
private String psword;
private String charset = Charset.defaultCharset().toString();
private static final int TIME_OUT = 1000 * 5 * 60 ;
/** */ /**
* 构造函数
* @param param 传入参数Bean 一些属性的getter setter 实现略
*/
public SshConnect(ExecInfo param) {
this .ip = param.getIp();
this .usr = param.getUser();
this .psword = param.getPassword();
}
/** */ /**
* 构造函数
* @param ip
* @param usr
* @param ps
*/
public SshConnect(String ip, String usr, String ps) {
this .ip = ip;
this&n