How to get ErrorStream for large Big Runtime.Exec operations
<p>I'm using the following code to get ErrorStream.</p>

<pre><code>shellinput[0] = "/system/xbin/dd if=/dev/zero of=";
shellinput[1] = newvfspath;
shellinput[2] = "/gtj.img bs=1000000 count=";
shellinput[3] = gtjsize;
System.out
        .println("Error Code (making new "
                + newvfspath
                + "/gtj.img ) :
            + errorstreamReader(shellinput)"
private String errorstreamReader(String[] shellinput) {
    InputStream inputstream = null;
    String esrval = null;
    System.out.println("Entering errorstreamReader");
    //hack to prevent executing null
    for (int i = 0; i &lt;= 3; i++) {
        if (shellinput[i] == null) {
            shellinput[i] = "";
        }
    }
    try {
    System.out.println("Executing " + shellinput[0]
                + shellinput[1] + shellinput[2] + shellinput[3]);
        inputstream = Runtime
                .getRuntime()
                .exec(shellinput[0] + " " + shellinput[1] + " "
                        + shellinput[2]).getErrorStream();
    } catch (IOException e) {
        e.printStackTrace();
    }
    InputStreamReader inputstreamreader = null;
    try {
        inputstreamreader = new InputStreamReader(inputstream);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    try {
        esrval = new BufferedReader(inputstreamreader).readLine();
    } catch (IOException e1) {
        e1.printStackTrace();
    }
    return esrval;
}
</code></pre>

<p>But the problem with this is <code>/system/xbin/dd if=/dev/zero of=./mnt/sdcard/cimages_2/gtj.img bs=1000000 count=100</code> is a pretty large operation, it takes like 8 secs. So It's not executing. How do I fix this?</p>

<p><strong>Edit :</strong> </p>

<p>Problem was not that it is a big operation. I figures it out. Thanks.</p>
