':type buf: Destination buffer (List[str])
:type n: Maximum number of characters to read (int)
:rtype: The number of characters read (int)'

def read(self, buf, n):

    i = 0
    while (i < n):
        if (self.__i4 < self.__n4):
            buf[i] = self.__buf4[self.__i4]
            i += 1
            self.__i4 += 1
        else:
            self.__n4 = read4(self.__buf4)
            if self.__n4:
                self.__i4 = 0
            else:
                break
    return i
