/** * Prints all that comes out of the pipe */ package gui; import java.io.*; /** * @author Jan Horky * */ public class StdOutCustomer extends Thread { private BufferedReader r; private TextConsoleWindow tcw; public StdOutCustomer(TextConsoleWindow tcw) { super(); this.setPriority(Thread.MAX_PRIORITY); this.tcw = tcw; r = new BufferedReader(new InputStreamReader(tcw.getStdOut())); this.start(); } // vypisuje co přijde rourou public void run() { try { String line = ""; while ((line = r.readLine()) != null) { try { tcw.writeData(line + "\n"); } catch (Exception e) { e.printStackTrace(); } } r.close(); } catch (Exception e) { } this.interrupt(); } }