'Read one line or up to `size` bytes from the file.
:Parameters:
- `size` (optional): the maximum number of bytes to read'

def readline(self, size=(-1)):

    if (size == 0):
        return ''
    remainder = (int(self.length) - self.__position)
    if ((size < 0) or (size > remainder)):
        size = remainder
    received = 0
    data = StringIO()
    while (received < size):
        chunk_data = self.readchunk()
        pos = chunk_data.find(NEWLN, 0, size)
        if (pos != (-1)):
            size = ((received + pos) + 1)
        received += len(chunk_data)
        data.write(chunk_data)
        if (pos != (-1)):
            break
    self.__position -= (received - size)
    data.seek(size)
    self.__buffer = data.read()
    data.seek(0)
    return data.read(size)
