def __init__(self, filename=None, mode=None, compresslevel=9,
fileobj=None, **kwargs):
"""
Return a buffered gzip file object.
:param filename: a filesystem path
:type filename: str
:param mode: a file mode which can be any of 'r', 'rb', 'a', 'ab',
'w', or 'wb'
:type mode: str
:param compresslevel: The compresslevel argument is an integer from 1
to 9 controlling the level of compression; 1 is fastest and
produces the least compression, and 9 is slowest and produces the
most compression. The default is 9.
:type compresslevel: int
:param fileobj: a BytesIO stream to read from instead of a file.
:type fileobj: BytesIO
:param size: number of bytes to buffer during calls to read() and write()
:type size: int
:rtype: BufferedGzipFile
"""
GzipFile.__init__(self, filename, mode, compresslevel, fileobj)
self._size = kwargs.get('size', self.SIZE)
self._buffer = BytesIO()
# cStringIO does not support len.
self._len = 0
评论列表
文章目录