日期:2014-05-20 浏览次数:20991 次
     Process ps = Runtime.getRuntime().exec(cmd);
    String str = (loadStream(ps.getInputStream()));
    }
    private String loadStream(InputStream in) throws IOException {
        int ptr = 0;
        in = new BufferedInputStream(in);
        StringBuffer buffer = new StringBuffer();
         while ((ptr = in.read()) != -1) {
         buffer.append((char) ptr);
         }
        return buffer.toString();
    }