import java.io.*; import java.util.*; public class Output implements Runnable{ Process q; InputStream stream; // initialize the class Output Output( Process p,InputStream s) { q = p; stream = s; } public void run() { try { BufferedReader in = new BufferedReader(new InputStreamReader(stream)); Vector lines = new Vector(); String line; while ((line = in.readLine()) != null) lines.addElement(line); if (lines.isEmpty() == false) { String[] r = new String[lines.size()]; lines.copyInto(r); for (int i = 0; i < lines.size(); i ++) { System.out.print(r[i]); System.out.print(" "); } System.out.println(); } } catch(RuntimeException e) { throw e; } catch(Exception e) { throw new RuntimeException(e.toString()); } }// end of run; }