Package org.apache.pekko.stream.javadsl
Class Compression
java.lang.Object
org.apache.pekko.stream.javadsl.Compression
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Flow<ByteString,ByteString, NotUsed> deflate()Creates a flow that deflate-compresses a stream of ByteString.static Flow<ByteString,ByteString, NotUsed> deflate(int level, boolean nowrap) Same asdeflate()with configurable level and nowrapstatic Flow<ByteString,ByteString, NotUsed> deflate(int level, boolean nowrap, boolean autoFlush) Same asdeflate()with configurable level, nowrap and autoFlush.static Flow<ByteString,ByteString, NotUsed> gzip()Creates a flow that gzip-compresses a stream of ByteStrings.static Flow<ByteString,ByteString, NotUsed> gzip(int level) Same asgzip()with a custom level.static Flow<ByteString,ByteString, NotUsed> gzip(int level, boolean autoFlush) Same asgzip()with a custom level and configurable flush mode.static Flow<ByteString,ByteString, NotUsed> gzipDecompress(int maxBytesPerChunk) Creates a Flow that decompresses gzip-compressed stream of data.static Flow<ByteString,ByteString, NotUsed> inflate(int maxBytesPerChunk) Creates a Flow that decompresses deflate-compressed stream of data.static Flow<ByteString,ByteString, NotUsed> inflate(int maxBytesPerChunk, boolean nowrap) Same asinflate(int)with configurable maximum output length and nowrapstatic Flow<ByteString,ByteString, NotUsed> zstd()Creates a flow that zstd-compresses a stream of ByteStrings, with the default compression level.static Flow<ByteString,ByteString, NotUsed> zstd(int level, Optional<ZstdDictionary> dictionary) Same aszstd()with a custom level and an optional dictionary.static Flow<ByteString,ByteString, NotUsed> zstd(ZstdCompressionSettings settings) Same aszstd()with the given settings, seepekko.stream.ZstdCompressionSettingsfor the level, flush mode, window size and dictionary.static Flow<ByteString,ByteString, NotUsed> zstdDecompress(int maxBytesPerChunk) Creates a flow that zstd-decompresses a stream of ByteStrings.static Flow<ByteString,ByteString, NotUsed> zstdDecompress(ZstdDecompressionSettings settings) Same aszstdDecompress(int)with the given settings, seepekko.stream.ZstdDecompressionSettingsfor the chunk size, window limit and dictionary.static final intThe maximum block size used by zstd decompressionstatic final intThe zstd default compression levelstatic final intThe maximum compression level supported by zstdstatic final intThe maximum window log supported by zstd compression on 64-bit platformsstatic final intThe minimum compression level supported by zstdstatic final intThe minimum window log supported by zstd compression
-
Constructor Details
-
Compression
public Compression()
-
-
Method Details
-
gzipDecompress
Creates a Flow that decompresses gzip-compressed stream of data.- Parameters:
maxBytesPerChunk- Maximum length of the outputpekko.util.ByteStringchunk.- Since:
- 1.3.0
-
inflate
Creates a Flow that decompresses deflate-compressed stream of data.- Parameters:
maxBytesPerChunk- Maximum length of the outputpekko.util.ByteStringchunk.
-
inflate
Same asinflate(int)with configurable maximum output length and nowrap- Parameters:
maxBytesPerChunk- Maximum length of the outputpekko.util.ByteStringchunk.nowrap- if true then use GZIP compatible decompression
-
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 everypekko.util.ByteStringcoming 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
Same asgzip()with a custom level.- Parameters:
level- Compression level (0-9)
-
gzip
Same asgzip()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
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 everypekko.util.ByteStringcoming 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
Same asdeflate()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, deflateNotUsed> (int level, boolean nowrap, boolean autoFlush) Same asdeflate()with configurable level, nowrap and autoFlush.- Parameters:
level- Compression level (0-9)nowrap- if true then use GZIP compatible compressionautoFlush- If true will automatically flush after every single element in the stream.- Since:
- 1.3.0
-
ZstdMinCompressionLevel
public static final int ZstdMinCompressionLevel()The minimum compression level supported by zstd- Since:
- 2.0.0
-
ZstdMaxCompressionLevel
public static final int ZstdMaxCompressionLevel()The maximum compression level supported by zstd- Since:
- 2.0.0
-
ZstdDefaultCompressionLevel
public static final int ZstdDefaultCompressionLevel()The zstd default compression level- Since:
- 2.0.0
-
ZstdMinWindowLog
public static final int ZstdMinWindowLog()The minimum window log supported by zstd compression- Since:
- 2.0.0
-
ZstdMaxWindowLog
public static final int ZstdMaxWindowLog()The maximum window log supported by zstd compression on 64-bit platforms- Since:
- 2.0.0
-
zstd
Creates a flow that zstd-compresses a stream of ByteStrings, with the default compression level.- Since:
- 2.0.0
-
zstd
public static Flow<ByteString,ByteString, zstdNotUsed> (int level, Optional<ZstdDictionary> dictionary) Same aszstd()with a custom level and an optional dictionary.- Parameters:
level- The compression level, must be greater or equal toZstdMinCompressionLevel()and less than or equal toZstdMaxCompressionLevel()dictionary- An optional dictionary that can be used for compression- Since:
- 2.0.0
-
zstd
Same aszstd()with the given settings, seepekko.stream.ZstdCompressionSettingsfor the level, flush mode, window size and dictionary.- Since:
- 2.0.0
-
ZstdDecompressMaxBlockSize
public static final int ZstdDecompressMaxBlockSize()The maximum block size used by zstd decompression- Since:
- 2.0.0
-
zstdDecompress
Creates a flow that zstd-decompresses a stream of ByteStrings.- Parameters:
maxBytesPerChunk- The maximum length of the emitted ByteStrings- Since:
- 2.0.0
-
zstdDecompress
public static Flow<ByteString,ByteString, zstdDecompressNotUsed> (ZstdDecompressionSettings settings) Same aszstdDecompress(int)with the given settings, seepekko.stream.ZstdDecompressionSettingsfor the chunk size, window limit and dictionary.- Since:
- 2.0.0
-