/** * Prints all that comes out of the pipe */ package gui; import java.io.*; /** * @author Jan Horky * */ public class ErrOutCustomer extends Thread { private BufferedReader r; private TextConsoleWindow tcw; public ErrOutCustomer(TextConsoleWindow tcw, InputStream errIn) { super(); this.setPriority(Thread.MAX_PRIORITY); this.tcw = tcw; r = new BufferedReader(new InputStreamReader(errIn)); 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(); // Thread.sleep(200); } catch (Exception e) { System.err.println(e.getMessage()); } this.interrupt(); } }