コード例 #1
0
 def __init__(self):
     if Zstd is None:
         raise UnsupportedCompressionMethodError
     self._buf = BufferedRW()
     ctx = Zstd.ZstdCompressor()  # type: ignore
     self._compressor = ctx.stream_writer(self._buf)
     self.flushed = False
コード例 #2
0
 def __init__(self, properties):
     if Zstd is None or len(properties) not in [
             3, 5
     ] or (properties[0], properties[1], 0) > Zstd.ZSTD_VERSION:
         raise UnsupportedCompressionMethodError
     self._buf = BufferedRW()
     ctx = Zstd.ZstdDecompressor()  # type: ignore
     self._decompressor = ctx.stream_writer(self._buf)
コード例 #3
0
 def __init__(self, properties: bytes, blocksize: Optional[int] = None):
     if not isinstance(properties, bytes):
         raise UnsupportedCompressionMethodError
     if len(properties) == 5:
         level, mem = struct.unpack("<BL", properties)
     elif len(properties) == 7:
         level, mem, _, _ = struct.unpack("<BLBB", properties)
     else:
         raise UnsupportedCompressionMethodError
     if blocksize:
         self.block_size = blocksize
     else:
         self.block_size = get_default_blocksize()
     self._buf = BufferedRW(self.block_size)
     self._buf = BufferedRW()
     self.decoder = None
     self.level = level
     self.mem = mem
     self.initialized = False
コード例 #4
0
 def __init__(self, properties: bytes):
     if Ppmd is None:
         raise UnsupportedCompressionMethodError
     if not isinstance(properties, bytes):
         raise UnsupportedCompressionMethodError
     if len(properties) == 5:
         level, mem = struct.unpack("<BL", properties)
     elif len(properties) == 7:
         level, mem, _, _ = struct.unpack("<BLBB", properties)
     else:
         raise UnsupportedCompressionMethodError
     self._buf = BufferedRW()
     self.decoder = None
     self.level = level
     self.mem = mem
     self.initialized = False
コード例 #5
0
 def __init__(self, level: int, mem: int):
     if Ppmd is None:
         raise UnsupportedCompressionMethodError
     self._buf = BufferedRW()
     self.encoder = Ppmd.Ppmd7Encoder(self._buf, level, mem)  # type: ignore
コード例 #6
0
 def __init__(self, level: int, mem: int, blocksize: Optional[int] = None):
     self._buf = BufferedRW(blocksize)
     self.encoder = Ppmd.Ppmd7Encoder(self._buf, level, mem)  # type: ignore
コード例 #7
0
 def __init__(self, level):
     self._buf = BufferedRW()
     ctx = zstandard.ZstdCompressor(level)  # type: ignore
     self._compressor = ctx.stream_writer(self._buf)
     self.flushed = False