1 17 18 19 21 39 40 import java.io.*; 42 46 public class ExtractorProcessOutputReader 47 implements Runnable 48 { 49 protected BufferedReader reader; 50 protected PrintStream out; 51 52 public ExtractorProcessOutputReader( InputStream input_stream, 53 PrintStream out ) 54 { 55 reader = new BufferedReader( new InputStreamReader( input_stream )); 58 this.out = out; 59 } 60 61 public void run() 62 { 63 try { 65 67 String line; 68 69 while ( (line = reader.readLine()) != null ) 70 { 71 out.println( line); 72 } 73 } 74 catch (IOException e) { System.err.println(e); 76 } 77 } 79 80 81 public void finalize() 82 throws Throwable 83 { 84 try { 86 if (reader != null) { 87 out.flush(); 88 reader.close(); 89 reader = null; 90 } 91 } 92 catch (IOException ioe) { 93 } 94 finally { 95 super.finalize(); } 97 } 98 } 99 100 102 103 | Popular Tags |