Here you can find the source of executeCmdForReader(String cmd)
public static BufferedReader executeCmdForReader(String cmd) throws IOException
//package com.java2s; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static BufferedReader executeCmdForReader(String cmd) throws IOException { Process pro = Runtime.getRuntime().exec(cmd); BufferedReader bufReader = new BufferedReader(new InputStreamReader(pro.getInputStream(), "UTF-8")); return bufReader; }//from w w w . java2 s .c o m }