Class ZipContentCodecBuilder

java.lang.Object
io.servicetalk.encoding.netty.ZipContentCodecBuilder

@Deprecated public abstract class ZipContentCodecBuilder extends Object
Deprecated.
Base class for Zip based content-codecs.
  • Method Details

    • withCompressionLevel

      public final ZipContentCodecBuilder withCompressionLevel(int compressionLevel)
      Deprecated.
      Sets the compression level for this codec's encoder.
      Parameters:
      compressionLevel - 1 yields the fastest compression and 9 yields the best compression, 0 means no compression.
      Returns:
      this
    • maxChunkSize

      public final ZipContentCodecBuilder maxChunkSize(int maxChunkSize)
      Deprecated.
      Set the max allowed chunk size the decoder may emit in a single inflate step. This does not bound the total decompressed payload size; see maxDecompressedBytes(long) for that.
      Parameters:
      maxChunkSize - the max allowed chunk size to inflate during decoding.
      Returns:
      this
    • maxDecompressedBytes

      public final ZipContentCodecBuilder maxDecompressedBytes(long maxDecompressedBytes)
      Deprecated.
      Set the maximum cumulative size in bytes of the decompressed payload produced by a single aggregated decode call. When the limit is exceeded the operation fails with a CodecDecodingException. Used to defend against decompression-bomb inputs where a small compressed payload expands to an unbounded amount of memory.

      Unlike maxChunkSize(int), which bounds only a single inflate step inside the codec, this bound is tracked across every chunk produced for the same input.

      Defaults to 64 MiB. The default can be overridden process-wide via the "io.servicetalk.encoding.netty.maxDecompressedBytes" system property (intended as an operational escape hatch for unforeseen issues — prefer per-builder configuration). A value of 0 disables the limit; callers that decode trusted input and need unbounded decompression can opt out, but doing so re-exposes the decompression-bomb attack surface.

      This setting does not apply to the streaming ContentCodec.decode(io.servicetalk.concurrent.api.Publisher, io.servicetalk.buffer.api.BufferAllocator) path. Streaming consumers typically process much larger payloads and are assumed to apply back-pressure; a streaming client that aggregates decoded chunks into a single buffer should enforce its own size bound.

      Parameters:
      maxDecompressedBytes - the max total decompressed bytes allowed per aggregated decode, or 0 for unbounded.
      Returns:
      this
    • build

      public abstract ContentCodec build()
      Deprecated.
      Build and return an instance of the ContentCodec with the configuration of the builder.
      Returns:
      the ContentCodec with the configuration of the builder