Lines Matching refs:fileobj
398 def __init__(self, name, mode, comptype, fileobj, bufsize): argument
402 if fileobj is None:
403 fileobj = _LowLevelFile(name, mode)
409 fileobj = _StreamProxy(fileobj)
410 comptype = fileobj.getcomptype()
415 self.fileobj = fileobj
446 self.fileobj.close()
485 self.fileobj.write(self.buf[:self.bufsize])
501 self.fileobj.write(self.buf)
510 self.fileobj.write(struct.pack("<L", self.crc & 0xffffffffL))
511 self.fileobj.write(struct.pack("<L", self.pos & 0xffffFFFFL))
514 self.fileobj.close()
612 buf = self.fileobj.read(self.bufsize)
627 def __init__(self, fileobj): argument
628 self.fileobj = fileobj
629 self.buf = self.fileobj.read(BLOCKSIZE)
632 self.read = self.fileobj.read
643 self.fileobj.close()
656 def __init__(self, fileobj, mode): argument
657 self.fileobj = fileobj
659 self.name = getattr(self.fileobj, "name", None)
667 self.fileobj.seek(0)
676 raw = self.fileobj.read(self.blocksize)
700 self.fileobj.write(raw)
705 self.fileobj.write(raw)
717 def __init__(self, fileobj, offset, size, sparse=None): argument
718 self.fileobj = fileobj
748 buf = self.fileobj.read(size)
756 self.fileobj.seek(self.offset + self.position)
784 self.fileobj.seek(self.offset + realpos)
800 self.fileobj = _FileInFile(tarfile.fileobj,
829 buf += self.fileobj.read()
831 buf += self.fileobj.read(size - len(buf))
849 buf = self.fileobj.read(self.blocksize)
904 self.fileobj.seek(self.position)
1251 buf = tarfile.fileobj.read(BLOCKSIZE)
1253 obj.offset = tarfile.fileobj.tell() - BLOCKSIZE
1284 self.offset_data = tarfile.fileobj.tell()
1301 buf = tarfile.fileobj.read(self._block(self.size))
1348 buf = tarfile.fileobj.read(BLOCKSIZE)
1369 self.offset_data = tarfile.fileobj.tell()
1380 buf = tarfile.fileobj.read(self._block(self.size))
1513 def __init__(self, name=None, mode="r", fileobj=None, format=None, argument
1530 if not fileobj:
1535 fileobj = bltn_open(name, self._mode)
1538 if name is None and hasattr(fileobj, "name"):
1539 name = fileobj.name
1540 if hasattr(fileobj, "mode"):
1541 self._mode = fileobj.mode
1544 self.fileobj = fileobj
1579 self.offset = self.fileobj.tell()
1593 self.fileobj.seek(self.offset)
1598 self.fileobj.seek(self.offset)
1608 self.fileobj.write(buf)
1612 self.fileobj.close()
1640 def open(cls, name=None, mode="r", fileobj=None, bufsize=RECORDSIZE, **kwargs): argument
1663 if not name and not fileobj:
1672 if fileobj is not None:
1673 saved_pos = fileobj.tell()
1675 return func(name, "r", fileobj, **kwargs)
1677 if fileobj is not None:
1678 fileobj.seek(saved_pos)
1693 return func(name, filemode, fileobj, **kwargs)
1703 stream = _Stream(name, filemode, comptype, fileobj, bufsize)
1713 return cls.taropen(name, mode, fileobj, **kwargs)
1718 def taropen(cls, name, mode="r", fileobj=None, **kwargs): argument
1723 return cls(name, mode, fileobj, **kwargs)
1726 def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs): argument
1740 fileobj = gzip.GzipFile(name, mode, compresslevel, fileobj)
1742 if fileobj is not None and mode == 'r':
1747 t = cls.taropen(name, mode, fileobj, **kwargs)
1749 fileobj.close()
1754 fileobj.close()
1760 def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs): argument
1772 if fileobj is not None:
1773 fileobj = _BZ2Proxy(fileobj, mode)
1775 fileobj = bz2.BZ2File(name, mode, compresslevel=compresslevel)
1778 t = cls.taropen(name, mode, fileobj, **kwargs)
1780 fileobj.close()
1785 fileobj.close()
1810 self.fileobj.write(NUL * (BLOCKSIZE * 2))
1816 self.fileobj.write(NUL * (RECORDSIZE - remainder))
1819 self.fileobj.close()
1848 def gettarinfo(self, name=None, arcname=None, fileobj=None): argument
1860 if fileobj is not None:
1861 name = fileobj.name
1879 if fileobj is None:
1885 statres = os.fstat(fileobj.fileno())
2037 def addfile(self, tarinfo, fileobj=None): argument
2049 self.fileobj.write(buf)
2053 if fileobj is not None:
2054 copyfileobj(fileobj, self.fileobj, tarinfo.size)
2057 self.fileobj.write(NUL * (BLOCKSIZE - remainder))
2158 if isinstance(self.fileobj, _Stream):
2349 if self.offset != self.fileobj.tell():
2350 self.fileobj.seek(self.offset - 1)
2351 if not self.fileobj.read(1):
2477 self.fileobj.close()