ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/conient/uk/org/iscream/cms/conient/DataReader.java
Revision: 1.6
Committed: Mon Jan 22 03:03:39 2001 UTC (23 years, 4 months ago) by ajm
Branch: MAIN
Changes since 1.5: +16 -9 lines
Log Message:
re-worked to be better OO... ;-)
added support for V1.0 client protocol
all still very messy....

File Contents

# User Rev Content
1 ajm 1.1 //---PACKAGE DECLARATION---
2    
3     //---IMPORTS---
4     import java.io.*;
5 ajm 1.5 import uk.ac.ukc.iscream.util.*;
6 ajm 1.1
7     /**
8     * Reads in bound data and presents it as it comes
9     * in for anything that wants it.
10     *
11 ajm 1.2 * @author $Author: ajm4 $
12 ajm 1.6 * @version $Id: DataReader.java,v 1.5 2001/01/20 16:06:53 ajm4 Exp $
13 ajm 1.1 */
14     public class DataReader extends Thread {
15    
16     //---FINAL ATTRIBUTES---
17    
18     /**
19     * The current CVS revision of this class
20     */
21 ajm 1.6 public final String REVISION = "$Revision: 1.5 $";
22 ajm 1.1
23     //---STATIC METHODS---
24    
25     //---CONSTRUCTORS---
26    
27 ajm 1.5 public DataReader(BufferedReader inBound, Queue dataQueue) {
28 ajm 1.1 _inBound = inBound;
29 ajm 1.5 _dataQueue = dataQueue;
30 ajm 1.1 }
31    
32     //---PUBLIC METHODS---
33    
34     public void run() {
35 ajm 1.3 try {
36 ajm 1.6
37     while (_running) {
38 ajm 1.5 _dataQueue.add(_inBound.readLine());
39 ajm 1.6 }
40    
41     //tidy up some stuff here at some point
42     _inBound.close();
43    
44 ajm 1.3 } catch (IOException e) {
45 ajm 1.6 SwingClient.addMessage("Data Channel Shutdown: reason - "+e);
46     _running = false;
47 ajm 1.1 }
48     }
49    
50     //---PRIVATE METHODS---
51    
52     //---ACCESSOR/MUTATOR METHODS---
53    
54 ajm 1.6 public void setRunning(boolean running) {
55     _running = running;
56     }
57    
58 ajm 1.1 //---ATTRIBUTES---
59    
60     BufferedReader _inBound;
61 ajm 1.5 Queue _dataQueue;
62 ajm 1.6 boolean _running = true;
63 ajm 1.1 //---STATIC ATTRIBUTES---
64    
65     }