1 |
//---PACKAGE DECLARATION--- |
2 |
|
3 |
//---IMPORTS--- |
4 |
import java.io.*; |
5 |
|
6 |
/** |
7 |
* Reads in bound data and presents it as it comes |
8 |
* in for anything that wants it. |
9 |
* |
10 |
* @author $Author: ajm4 $ |
11 |
* @version $Id: DataReader.java,v 1.3 2001/01/15 03:01:37 ajm4 Exp $ |
12 |
*/ |
13 |
public class DataReader extends Thread { |
14 |
|
15 |
//---FINAL ATTRIBUTES--- |
16 |
|
17 |
/** |
18 |
* The current CVS revision of this class |
19 |
*/ |
20 |
public final String REVISION = "$Revision: 1.3 $"; |
21 |
|
22 |
//---STATIC METHODS--- |
23 |
|
24 |
//---CONSTRUCTORS--- |
25 |
|
26 |
public DataReader(BufferedReader inBound) { |
27 |
_inBound = inBound; |
28 |
} |
29 |
|
30 |
//---PUBLIC METHODS--- |
31 |
|
32 |
public void run() { |
33 |
boolean running = true; |
34 |
try { |
35 |
while (true) { |
36 |
_xml = _inBound.readLine(); |
37 |
synchronized (this) { |
38 |
notifyAll(); |
39 |
} |
40 |
} |
41 |
} catch (IOException e) { |
42 |
System.err.println("This DataReader thread has been shut down as an exception occured: "+e); |
43 |
running = false; |
44 |
return; |
45 |
} |
46 |
} |
47 |
|
48 |
//---PRIVATE METHODS--- |
49 |
|
50 |
//---ACCESSOR/MUTATOR METHODS--- |
51 |
|
52 |
public String getXML() { |
53 |
return _xml; |
54 |
} |
55 |
|
56 |
//---ATTRIBUTES--- |
57 |
|
58 |
BufferedReader _inBound; |
59 |
String _xml; |
60 |
|
61 |
//---STATIC ATTRIBUTES--- |
62 |
|
63 |
} |