当前位置: 首页>>代码示例>>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;未经允许,请勿转载。