Use python bytes instead of QByteArray methods.

This commit is contained in:
Florian Bruhin 2014-02-21 07:38:37 +01:00
parent 435f1f45e0
commit 51616937b8

View File

@ -93,8 +93,8 @@ class SpecialNetworkReply(QNetworkReply):
bytes available (int) bytes available (int)
""" """
return self._data.length() + super().bytesAvailable()
logging.debug("bytes available: {}".format(len(self._data))) logging.debug("bytes available: {}".format(len(self._data)))
return len(self._data) + super().bytesAvailable()
def readData(self, maxlen): def readData(self, maxlen):
"""Retrieve data from the reply object. """Retrieve data from the reply object.
@ -106,8 +106,8 @@ class SpecialNetworkReply(QNetworkReply):
bytestring containing the data bytestring containing the data
""" """
len_ = min(maxlen, self._data.length()) len_ = min(maxlen, len(self._data))
buf = bytes(self._data[:len_]) buf = bytes(self._data[:len_])
self._data.remove(0, len_)
logging.debug("readdata, len {}, maxlen {}, buf {}".format(len(self._data), maxlen, buf)) logging.debug("readdata, len {}, maxlen {}, buf {}".format(len(self._data), maxlen, buf))
self._data = self._data[len_:]
return buf return buf