ExternalCommand.java :  » Remote » proxki » Proxki_server » Android Open Source

Android Open Source » Remote » proxki 
proxki » Proxki_server » ExternalCommand.java
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package proxki_server;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author static
 */
public class ExternalCommand {


    //global variables
    public final static String extCommand = "./usbRelay";

    public void executeRelay() {
        Runtime runtime = Runtime.getRuntime();

        try {
            Process process = runtime.exec (extCommand);
            //done executing command
            //get the input stream from the subprocess
            BufferedReader out = new BufferedReader( new InputStreamReader (process.getInputStream()));
            String line = out.readLine();
            while (line != null) {
                System.out.println(line);
                line = out.readLine();
            }

        }
        catch (IOException e) {
            System.out.println (e.toString());
        }
    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.