Class Zstd
java.lang.Object
org.apache.pekko.http.scaladsl.coding.Zstd
INTERNAL API
An encoder and decoder for the HTTP 'zstd' encoding (RFC 8878), use Coders.Zstd to get one.
zstd is implemented by pekko-stream, which needs the optional com.github.luben:zstd-jni dependency
on the classpath.
RFC 9659 limits the window of the 'zstd' content coding to 8 MB: encoders must not need a larger window, and
decoders only have to support up to that. So the encoder caps the window of the compression levels that
would use a larger one, and the decoder rejects frames that need more than 2^windowLogMax bytes.
param: windowLogMax the log2 of the largest window the decoder accepts, 0 uses the limit of libzstd (128 MB)
-
Constructor Summary
ConstructorsConstructorDescriptionZstd(int compressionLevel, scala.Function1<HttpMessage, Object> messageFilter, int maxBytesPerChunk, int windowLogMax) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.pekko.stream.scaladsl.Flow<org.apache.pekko.util.ByteString,org.apache.pekko.util.ByteString, org.apache.pekko.NotUsed> static ZstdDefault()static intstatic intencoding()intstatic intThe 8 MB window that RFC 9659 allows for the 'zstd' content codingscala.Function1<HttpMessage,Object> static intwindowLogFor(int compressionLevel) withLevel(int level) withMaxBytesPerChunk(int newMaxBytesPerChunk) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.pekko.http.scaladsl.coding.Decoder
decode, decodeData, decodeMessageMethods inherited from interface org.apache.pekko.http.scaladsl.coding.Encoder
encodeAsync, encodeData, encodeMessage, encoderFlow, singleUseEncoderFlow
-
Constructor Details
-
Zstd
public Zstd(int compressionLevel, scala.Function1<HttpMessage, Object> messageFilter, int maxBytesPerChunk, int windowLogMax)
-
-
Method Details
-
DefaultCompressionLevel
public static int DefaultCompressionLevel() -
MaxWindowLog
public static int MaxWindowLog()The 8 MB window that RFC 9659 allows for the 'zstd' content coding -
DefaultWindowLogMax
public static int DefaultWindowLogMax() -
windowLogFor
public static int windowLogFor(int compressionLevel) -
Default
-
messageFilter
- Specified by:
messageFilterin interfaceEncoder
-
maxBytesPerChunk
public int maxBytesPerChunk()- Specified by:
maxBytesPerChunkin interfaceDecoder
-
encoding
-
newCompressor
- Specified by:
newCompressorin interfaceEncoder
-
withMaxBytesPerChunk
- Specified by:
withMaxBytesPerChunkin interfaceDecoder
-
decoderFlow
public org.apache.pekko.stream.scaladsl.Flow<org.apache.pekko.util.ByteString,org.apache.pekko.util.ByteString, decoderFlow()org.apache.pekko.NotUsed> - Specified by:
decoderFlowin interfaceDecoder
-
withLevel
-