Class Compression


  • public class Compression
    extends java.lang.Object
    Creates a Flow that decompresses gzip-compressed stream of data.

    param: maxBytesPerChunk Maximum length of the output ByteString chunk.

    • Constructor Detail

      • Compression

        public Compression()
    • Method Detail

      • inflate

        public static Flow<ByteString,​ByteString,​NotUsed> inflate​(int maxBytesPerChunk)
        Creates a Flow that decompresses deflate-compressed stream of data.

        Parameters:
        maxBytesPerChunk - Maximum length of the output ByteString chunk.
        Returns:
        (undocumented)
      • inflate

        public static Flow<ByteString,​ByteString,​NotUsed> inflate​(int maxBytesPerChunk,
                                                                              boolean nowrap)
        Same as inflate(int) with configurable maximum output length and nowrap

        Parameters:
        maxBytesPerChunk - Maximum length of the output ByteString chunk.
        nowrap - if true then use GZIP compatible decompression
        Returns:
        (undocumented)
      • gzip

        public static Flow<ByteString,​ByteString,​NotUsed> gzip()
        Creates a flow that gzip-compresses a stream of ByteStrings. Note that the compressor will SYNC_FLUSH after every ByteString so that it is guaranteed that every ByteString coming out of the flow can be fully decompressed without waiting for additional data. This may come at a compression performance cost for very small chunks.
        Returns:
        (undocumented)
      • gzip

        public static Flow<ByteString,​ByteString,​NotUsed> gzip​(int level)
        Same as gzip() with a custom level.

        Parameters:
        level - Compression level (0-9)
        Returns:
        (undocumented)
      • deflate

        public static Flow<ByteString,​ByteString,​NotUsed> deflate()
        Creates a flow that deflate-compresses a stream of ByteString. Note that the compressor will SYNC_FLUSH after every ByteString so that it is guaranteed that every ByteString coming out of the flow can be fully decompressed without waiting for additional data. This may come at a compression performance cost for very small chunks.
        Returns:
        (undocumented)
      • deflate

        public static Flow<ByteString,​ByteString,​NotUsed> deflate​(int level,
                                                                              boolean nowrap)
        Same as deflate() with configurable level and nowrap

        Parameters:
        level - Compression level (0-9)
        nowrap - if true then use GZIP compatible compression
        Returns:
        (undocumented)