java.lang.Object
org.apache.pekko.http.scaladsl.coding.Coders

public class Coders extends Object
  • Constructor Details

    • Coders

      public Coders()
  • Method Details

    • Gzip

      public static Coder Gzip()
    • Gzip

      public static Coder Gzip(scala.Function1<HttpMessage,Object> messageFilter, int compressionLevel)
    • Deflate

      public static Coder Deflate()
    • Deflate

      public static Coder Deflate(scala.Function1<HttpMessage,Object> messageFilter, int compressionLevel)
    • NoCoding

      public static Coder NoCoding()
    • Zstd

      public static Coder Zstd()
      A coder for the 'zstd' encoding. It is not one of the DefaultCoders(), as it needs the optional com.github.luben:zstd-jni dependency on the classpath, version 1.5.7-25 or later.

      Following RFC 9659, it does not compress with a window larger than 8 MB, and does not decode frames that need a larger window, so that a peer cannot make it allocate more memory than that for one message.

      Returns:
      (undocumented)
      Since:
      2.0.0
    • Zstd

      public static Coder Zstd(scala.Function1<HttpMessage,Object> messageFilter, int compressionLevel, int windowLogMax)
      A coder for the 'zstd' encoding with a custom message filter, compression level and decoder window limit, see Zstd.

      Parameters:
      compressionLevel - must be between Compression.ZstdMinCompressionLevel and Compression.ZstdMaxCompressionLevel of pekko-stream
      windowLogMax - the log2 of the largest window that the decoder accepts, 23 (8 MB, the limit of RFC 9659) by default. It must be 0 or between Compression.ZstdMinWindowLog and Compression.ZstdMaxWindowLog of pekko-stream; 0 uses the limit of libzstd (128 MB) and also works with versions of zstd-jni older than 1.5.7-25
      messageFilter - (undocumented)
      Returns:
      (undocumented)
      Since:
      2.0.0
    • DefaultCoders

      public static scala.collection.immutable.Seq<Coder> DefaultCoders()
    • decodeMessage

      public static org.apache.pekko.http.scaladsl.coding.Coders.message decodeMessage(HttpMessage message, scala.collection.immutable.Seq<Decoder> decoders)
      Decodes the message with the one of decoders whose encoding matches the message's Content-Encoding header, for example to decode a response on the client side without checking its encoding first.

      The message is returned unchanged if it has no Content-Encoding header, if none of decoders matches its encoding, or if the header lists more than one encoding. In the last two cases the Content-Encoding header is kept, so message.encoding shows that the entity is still encoded.

      Parameters:
      decoders - the decoders to choose from, Zstd is not one of the DefaultCoders()
      message - (undocumented)
      Returns:
      (undocumented)
      Since:
      2.0.0