1 |
ajm |
1.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 |
ajm |
1.2 |
* @author $Author: ajm4 $ |
11 |
|
|
* @version $Id: DataReader.java,v 1.1 2001/01/14 21:22:34 ajm4 Exp $ |
12 |
ajm |
1.1 |
*/ |
13 |
|
|
public class DataReader extends Thread { |
14 |
|
|
|
15 |
|
|
//---FINAL ATTRIBUTES--- |
16 |
|
|
|
17 |
|
|
/** |
18 |
|
|
* The current CVS revision of this class |
19 |
|
|
*/ |
20 |
ajm |
1.2 |
public final String REVISION = "$Revision: 1.1 $"; |
21 |
ajm |
1.1 |
|
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 |
|
|
while (running){ |
35 |
|
|
try { |
36 |
|
|
|
37 |
|
|
_xml = _inBound.readLine(); |
38 |
ajm |
1.2 |
synchronized (this) { |
39 |
|
|
notifyAll(); |
40 |
|
|
} |
41 |
ajm |
1.1 |
} |
42 |
|
|
catch (IOException e) { |
43 |
|
|
System.err.println("This DataReader thread has been shut down as an exception occured: "+e); |
44 |
|
|
running = false; |
45 |
|
|
return; |
46 |
|
|
} |
47 |
|
|
} |
48 |
|
|
} |
49 |
|
|
|
50 |
|
|
//---PRIVATE METHODS--- |
51 |
|
|
|
52 |
|
|
//---ACCESSOR/MUTATOR METHODS--- |
53 |
|
|
|
54 |
|
|
public String getXML() { |
55 |
|
|
return _xml; |
56 |
|
|
} |
57 |
|
|
|
58 |
|
|
//---ATTRIBUTES--- |
59 |
|
|
|
60 |
|
|
BufferedReader _inBound; |
61 |
|
|
String _xml; |
62 |
|
|
|
63 |
|
|
//---STATIC ATTRIBUTES--- |
64 |
|
|
|
65 |
|
|
} |