Wrap read request, concatenating partial reads until whole request have been read

This commit is contained in:
Henrik Nordström 2010-09-05 21:04:22 +08:00 committed by Aldo Cortesi
parent e98a035540
commit 2e7e9f9759
1 changed files with 9 additions and 0 deletions

View File

@ -192,6 +192,15 @@ class FileLike:
def flush(self): def flush(self):
pass pass
def read(self, length):
result = ''
while len(result) < length:
data = self.o.read(length)
if not data:
break
result += data
return result
def readline(self): def readline(self):
result = '' result = ''
while True: while True: