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-Encodingand related headers. - On malformed input it throws an
IOExceptionwith a descriptive message. releaseResources()must be called to free native resources.
- Since:
- 5.6
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicBooleanprivate final com.github.luben.zstd.ZstdDecompressCtxprivate final org.apache.hc.core5.http.nio.AsyncDataConsumerprivate static final intprivate final ByteBufferprivate static final intprivate final ByteBuffer -
Constructor Summary
ConstructorsConstructorDescriptionInflatingZstdDataConsumer(org.apache.hc.core5.http.nio.AsyncDataConsumer downstream) -
Method Summary
Modifier and TypeMethodDescriptionvoidconsume(ByteBuffer src) voidvoidvoidupdateCapacity(org.apache.hc.core5.http.nio.CapacityChannel c)
-
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
-
outDirect
-
closed
-
-
Constructor Details
-
InflatingZstdDataConsumer
public InflatingZstdDataConsumer(org.apache.hc.core5.http.nio.AsyncDataConsumer downstream)
-
-
Method Details
-
updateCapacity
- Specified by:
updateCapacityin interfaceorg.apache.hc.core5.http.nio.AsyncDataConsumer- Throws:
IOException
-
consume
- Specified by:
consumein interfaceorg.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:
streamEndin interfaceorg.apache.hc.core5.http.nio.AsyncDataConsumer- Throws:
org.apache.hc.core5.http.HttpExceptionIOException
-
releaseResources
public void releaseResources()- Specified by:
releaseResourcesin interfaceorg.apache.hc.core5.http.nio.ResourceHolder
-