Class InflatingZstdDataConsumer

java.lang.Object
org.apache.hc.client5.http.async.methods.InflatingZstdDataConsumer
All Implemented Interfaces:
org.apache.hc.core5.http.nio.AsyncDataConsumer, org.apache.hc.core5.http.nio.ResourceHolder

public final class InflatingZstdDataConsumer extends Object implements org.apache.hc.core5.http.nio.AsyncDataConsumer
AsyncDataConsumer that inflates Zstandard (zstd) content codings.

This consumer accepts compressed bytes and forwards decompressed data to a downstream AsyncDataConsumer. It is intended to be installed by the client execution chain when a response carries Content-Encoding: zstd. Applications normally do not instantiate it directly—enable content compression (default) and let ContentCompressionAsyncExec wire it automatically.

Behavior

  • Streams decompression as data arrives; does not require the full message in memory.
  • Updates the downstream with plain bytes; the client removes the original Content-Encoding and related headers.
  • On malformed input it throws an IOException with a descriptive message.
  • releaseResources() must be called to free native resources.
Since:
5.6
  • Field Details

    • IN_BUF

      private static final int IN_BUF
      See Also:
    • OUT_BUF

      private static final int OUT_BUF
      See Also:
    • downstream

      private final org.apache.hc.core5.http.nio.AsyncDataConsumer downstream
    • dctx

      private final com.github.luben.zstd.ZstdDecompressCtx dctx
    • inDirect

      private final ByteBuffer inDirect
    • outDirect

      private final ByteBuffer outDirect
    • closed

      private final AtomicBoolean closed
  • Constructor Details

    • InflatingZstdDataConsumer

      public InflatingZstdDataConsumer(org.apache.hc.core5.http.nio.AsyncDataConsumer downstream)
  • Method Details

    • updateCapacity

      public void updateCapacity(org.apache.hc.core5.http.nio.CapacityChannel c) throws IOException
      Specified by:
      updateCapacity in interface org.apache.hc.core5.http.nio.AsyncDataConsumer
      Throws:
      IOException
    • consume

      public void consume(ByteBuffer src) throws IOException
      Specified by:
      consume in interface org.apache.hc.core5.http.nio.AsyncDataConsumer
      Throws:
      IOException
    • streamEnd

      public void streamEnd(List<? extends org.apache.hc.core5.http.Header> trailers) throws org.apache.hc.core5.http.HttpException, IOException
      Specified by:
      streamEnd in interface org.apache.hc.core5.http.nio.AsyncDataConsumer
      Throws:
      org.apache.hc.core5.http.HttpException
      IOException
    • releaseResources

      public void releaseResources()
      Specified by:
      releaseResources in interface org.apache.hc.core5.http.nio.ResourceHolder