Example usage for java.io DataOutputStream wait

List of usage examples for java.io DataOutputStream wait

Introduction

In this page you can find the example usage for java.io DataOutputStream wait.

Prototype

public final void wait() throws InterruptedException 

Source Link

Document

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Usage

From source file:Main.java

public static void execCommand(String paramString) {
    try {/*w ww  . j  a va2 s .  c  o m*/
        String[] arrayOfString = new String[1];
        arrayOfString[0] = paramString;
        DataOutputStream localDataOutputStream = new DataOutputStream(
                Runtime.getRuntime().exec("su").getOutputStream());
        for (int i = 0;; i++) {
            if (i >= 1) {
                localDataOutputStream.writeBytes("exit\n");
                localDataOutputStream.flush();
                localDataOutputStream.wait();
                return;
            }
            localDataOutputStream.writeBytes(arrayOfString[i] + "\n");
            localDataOutputStream.flush();
        }
    } catch (Exception localException) {
    }
}