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 java.lang.Object implements org.apache.hc.core5.http.nio.AsyncDataConsumerAsyncDataConsumerthat 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 carriesContent-Encoding: zstd. Applications normally do not instantiate it directly—enable content compression (default) and letContentCompressionAsyncExecwire 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
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicBooleanclosedprivate com.github.luben.zstd.ZstdDecompressCtxdctxprivate org.apache.hc.core5.http.nio.AsyncDataConsumerdownstreamprivate static intIN_BUFprivate java.nio.ByteBufferinDirectprivate static intOUT_BUFprivate java.nio.ByteBufferoutDirect
-
Constructor Summary
Constructors Constructor Description InflatingZstdDataConsumer(org.apache.hc.core5.http.nio.AsyncDataConsumer downstream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconsume(java.nio.ByteBuffer src)voidreleaseResources()voidstreamEnd(java.util.List<? extends org.apache.hc.core5.http.Header> trailers)voidupdateCapacity(org.apache.hc.core5.http.nio.CapacityChannel c)
-
-
-
Field Detail
-
IN_BUF
private static final int IN_BUF
- See Also:
- Constant Field Values
-
OUT_BUF
private static final int OUT_BUF
- See Also:
- Constant Field Values
-
downstream
private final org.apache.hc.core5.http.nio.AsyncDataConsumer downstream
-
dctx
private final com.github.luben.zstd.ZstdDecompressCtx dctx
-
inDirect
private final java.nio.ByteBuffer inDirect
-
outDirect
private final java.nio.ByteBuffer outDirect
-
closed
private final java.util.concurrent.atomic.AtomicBoolean closed
-
-
Method Detail
-
updateCapacity
public void updateCapacity(org.apache.hc.core5.http.nio.CapacityChannel c) throws java.io.IOException- Specified by:
updateCapacityin interfaceorg.apache.hc.core5.http.nio.AsyncDataConsumer- Throws:
java.io.IOException
-
consume
public void consume(java.nio.ByteBuffer src) throws java.io.IOException- Specified by:
consumein interfaceorg.apache.hc.core5.http.nio.AsyncDataConsumer- Throws:
java.io.IOException
-
streamEnd
public void streamEnd(java.util.List<? extends org.apache.hc.core5.http.Header> trailers) throws org.apache.hc.core5.http.HttpException, java.io.IOException- Specified by:
streamEndin interfaceorg.apache.hc.core5.http.nio.AsyncDataConsumer- Throws:
org.apache.hc.core5.http.HttpExceptionjava.io.IOException
-
releaseResources
public void releaseResources()
- Specified by:
releaseResourcesin interfaceorg.apache.hc.core5.http.nio.ResourceHolder
-
-