當前位置: 首頁>>代碼示例>>Python>>正文


Python snappy.StreamCompressor方法代碼示例

本文整理匯總了Python中snappy.StreamCompressor方法的典型用法代碼示例。如果您正苦於以下問題:Python snappy.StreamCompressor方法的具體用法?Python snappy.StreamCompressor怎麽用?Python snappy.StreamCompressor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在snappy的用法示例。


在下文中一共展示了snappy.StreamCompressor方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import snappy [as 別名]
# 或者: from snappy import StreamCompressor [as 別名]
def __init__(self, infile, mode, **kwargs):
        import snappy

        self.details = {"size": 999999999}  # not true, but OK if we don't seek
        super().__init__(fs=None, path="snappy", mode=mode.strip("b") + "b", **kwargs)
        self.infile = infile
        if "r" in mode:
            self.codec = snappy.StreamDecompressor()
        else:
            self.codec = snappy.StreamCompressor() 
開發者ID:intake,項目名稱:filesystem_spec,代碼行數:12,代碼來源:compression.py

示例2: __init__

# 需要導入模塊: import snappy [as 別名]
# 或者: from snappy import StreamCompressor [as 別名]
def __init__(self, socket):
        self._decompressor = snappy.StreamDecompressor()
        self._compressor = snappy.StreamCompressor()
        super(SnappySocket, self).__init__(socket) 
開發者ID:wtolson,項目名稱:gnsq,代碼行數:6,代碼來源:snappy.py

示例3: _write_with_snappy

# 需要導入模塊: import snappy [as 別名]
# 或者: from snappy import StreamCompressor [as 別名]
def _write_with_snappy(data: bytes, stream: INetStream) -> None:
    compressor = StreamCompressor()
    data_reader = io.BytesIO(data)
    chunk = data_reader.read(MAX_CHUNK_SIZE)
    while chunk:
        chunk = compressor.add_chunk(chunk)
        await stream.write(chunk)
        chunk = data_reader.read(MAX_CHUNK_SIZE) 
開發者ID:ethereum,項目名稱:trinity,代碼行數:10,代碼來源:request_responder.py

示例4: __init__

# 需要導入模塊: import snappy [as 別名]
# 或者: from snappy import StreamCompressor [as 別名]
def __init__(self, src_fp, algorithm, level=0):
        super().__init__(src_fp, minimum_read_size=32 * 1024)
        if algorithm == "lzma":
            self._compressor = lzma.LZMACompressor(lzma.FORMAT_XZ, -1, level, None)
        elif algorithm == "snappy":
            self._compressor = snappy.StreamCompressor()
        elif algorithm == "zstd":
            self._compressor = zstd.ZstdCompressor(level=level).compressobj()
        else:
            InvalidConfigurationError("invalid compression algorithm: {!r}".format(algorithm)) 
開發者ID:aiven,項目名稱:pghoard,代碼行數:12,代碼來源:compressor.py

示例5: __init__

# 需要導入模塊: import snappy [as 別名]
# 或者: from snappy import StreamCompressor [as 別名]
def __init__(self, next_fp, mode):
        if snappy is None:
            raise io.UnsupportedOperation("Snappy is not available")

        if mode == "rb":
            self.decr = snappy.StreamDecompressor()
            self.encr = None
        elif mode == "wb":
            self.decr = None
            self.encr = snappy.StreamCompressor()
        else:
            raise io.UnsupportedOperation("unsupported mode for SnappyFile")

        super().__init__(next_fp)
        self.decr_done = False 
開發者ID:aiven,項目名稱:pghoard,代碼行數:17,代碼來源:snappyfile.py


注:本文中的snappy.StreamCompressor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。