def read(self, want=<NUM_LIT:0>):
if self._finished:<EOL><INDENT>if self._finished == <NUM_LIT:1>:<EOL><INDENT>self._finished += <NUM_LIT:1><EOL>return "<STR_LIT>"<EOL><DEDENT>return EOFError("<STR_LIT>")<EOL><DEDENT>self._want = want<EOL>self._add.set()<EOL>self._result.wait()<EOL>self._result.clear()<EOL>if want:<EOL><INDENT>data = self._data[:want]<EOL>self._data = self._data[want:]<EOL><DEDENT>else:<EOL><INDENT>data = self._data<EOL>self._data = bytes()<EOL><DEDENT>return data<EOL>
Read method, gets data from internal buffer while releasing
:meth:`write` locks when needed.

The lock usage means it must ran on a different thread than
:meth:`fill`, ie. the main thread, otherwise will deadlock.

The combination of both write and this method running on different
threads makes tarfile being streamed on-the-fly, with data chunks being
processed and retrieved on demand.

:param want: number bytes to read, defaults to 0 (all available)
:type want: int
:returns: tarfile data as bytes
:rtype: bytes