'Read all or specified amount of data from archive entry.'

def read(self, cnt=None):

    if ((cnt is None) or (cnt < 0)):
        cnt = self._remain
    elif (cnt > self._remain):
        cnt = self._remain
    if (cnt == 0):
        return EMPTY
    data = self._read(cnt)
    if data:
        self._md_context.update(data)
        self._remain -= len(data)
    if (len(data) != cnt):
        raise BadRarFile('Failed    the    read    enough    data')
    if ((not data) or (self._remain == 0)):
        self._check()
    return data
