StreamReader.py 567 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class StreamReader:

    def __init__(self, stream):
        self.stream = stream
        pass

    def start(self, decoder, version):
        other_version = decoder.decode_string()
        if version != other_version:
            raise Exception("LabComm version mismatch %s != %s" %
                            (version, other_version))
        pass

    def read(self, count):
        result = self.stream.read(count)
        if len(result) == 0:
            raise EOFError()
        return result

    def mark(self, value, decl):
        pass
        
    pass