KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > common > dods > ErrorReader


1 package org.enhydra.kelp.common.dods;
2
3 import java.io.BufferedReader JavaDoc;
4 import java.io.PrintStream JavaDoc;
5 import org.enhydra.kelp.common.AbstractEchoBuilder;
6
7 /**
8  * This thread used for read error messages from executing process
9  */

10 public class ErrorReader extends Thread JavaDoc {
11     BufferedReader JavaDoc er;
12     AbstractEchoBuilder aeg ;
13
14     public ErrorReader(BufferedReader JavaDoc bufferedreader, AbstractEchoBuilder aEcho) {
15         aeg = aEcho;
16         er = bufferedreader;
17     }
18
19     public void run() {
20         try {
21             for(; !er.ready(); Thread.sleep(100L)) { }
22             String JavaDoc s;
23             while((s = er.readLine()) != null) {
24                                     aeg.echo(s+"\n");
25             }
26         }
27         catch(Exception JavaDoc exception) { }
28     }
29 }
30
Popular Tags