Class Compression

java.lang.Object
org.apache.pekko.stream.javadsl.Compression

public class Compression extends Object
  • Constructor Details

    • Compression

      public Compression()
  • Method Details

    • gzipDecompress

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

      Parameters:
      maxBytesPerChunk - Maximum length of the output pekko.util.ByteString chunk.
      Since:
      1.3.0
    • 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 pekko.util.ByteString chunk.
    • 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 pekko.util.ByteString chunk.
      nowrap - if true then use GZIP compatible decompression
    • gzip

      public static Flow<ByteString,ByteString,NotUsed> gzip()
      Creates a flow that gzip-compresses a stream of ByteStrings. Note that the compressor will flush after every single element in stream so that it is guaranteed that every pekko.util.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.
    • gzip

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

      Parameters:
      level - Compression level (0-9)
    • gzip

      public static Flow<ByteString,ByteString,NotUsed> gzip(int level, boolean autoFlush)
      Same as gzip() with a custom level and configurable flush mode.

      Parameters:
      level - Compression level (0-9)
      autoFlush - If true will automatically flush after every single element in the stream.

      Since:
      1.3.0
    • deflate

      public static Flow<ByteString,ByteString,NotUsed> deflate()
      Creates a flow that deflate-compresses a stream of ByteString. Note that the compressor will flush after every single element in stream so that it is guaranteed that every pekko.util.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.
    • 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
    • deflate

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

      Parameters:
      level - Compression level (0-9)
      nowrap - if true then use GZIP compatible compression
      autoFlush - If true will automatically flush after every single element in the stream.

      Since:
      1.3.0