def read(self, size=None):
        """Return the next size number of bytes from the stream.
           If size is not defined, return all bytes of the stream
           up to EOF.
        """
        if size is None:
            t = []
            while True:
                buf = self._read(self.bufsize)
                if not buf:
                    break
                t.append(buf)
            buf = "".join(t)
        else:
            buf = self._read(size)
        self.pos += len(buf)
        return buf
Return the next size number of bytes from the stream.
           If size is not defined, return all bytes of the stream
           up to EOF.
        
product/gradle-plugin/src/main/python/pip/_vendor/distlib/_backport/tarfile.py