• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package jdiff;
2 
3 import java.util.*;
4 import java.io.*;
5 
6 /**
7  * Reads in lines from an input stream and displays them.
8  *
9  * See the file LICENSE.txt for copyright details.
10  * @author Matthew Doar, mdoar@pobox.com.
11  */
12 class StreamReader extends Thread {
13     /** The input stream. */
14     InputStream is_;
15 
16     /** Constructor which takes an InputStream. */
StreamReader(InputStream is)17     StreamReader(InputStream is) {
18         is_ = is;
19     }
20 
21     /** Method which is called when this thread is started. */
run()22     public void run() {
23         try {
24             InputStreamReader isr = new InputStreamReader(is_);
25             BufferedReader br = new BufferedReader(isr);
26             String line = null;
27             while((line = br.readLine()) != null)
28                 System.out.println(line);
29         } catch (IOException ioe) {
30             System.out.println("IO Error invoking Javadoc");
31             ioe.printStackTrace();
32         } catch (Exception e) {
33             // Ignore read errors which indicate that the process is complete
34         }
35     }
36 }
37