1 package org.jacorb.trading.test; 2 3 import java.io.*; 4 10 11 public class OutputForwarder extends Thread { 12 private File m_out = null; 13 private Process m_process = null; 14 15 public OutputForwarder (Process proc, String filename){ 16 m_process = proc; 17 m_out = new File(filename); 18 19 start(); 20 } 21 22 public void run(){ 23 BufferedReader _in = new BufferedReader(new InputStreamReader(m_process.getInputStream())); 24 String _line = null; 25 PrintWriter _out = null; 26 27 try{ 28 _out = new PrintWriter(new FileWriter(m_out)); 29 30 while((_line = _in.readLine()) != null) 34 _out.println(_line); 35 36 }catch (Exception _e){ 37 _e.printStackTrace(); 38 } 39 finally{ 40 try{ 41 _in.close(); 42 _out.flush(); 43 _out.close(); 44 }catch (Exception _e){ 45 _e.printStackTrace(); 46 } 47 } 48 System.out.println("A Trader has exited"); 49 50 } 51 } 53 54 55 56 57 58 59 60 61 62 63 64 | Popular Tags |