Class InflatingBrotliDataConsumer
- java.lang.Object
-
- org.apache.hc.client5.http.async.methods.InflatingBrotliDataConsumer
-
- All Implemented Interfaces:
org.apache.hc.core5.http.nio.AsyncDataConsumer,org.apache.hc.core5.http.nio.ResourceHolder
public final class InflatingBrotliDataConsumer extends java.lang.Object implements org.apache.hc.core5.http.nio.AsyncDataConsumerAsyncDataConsumerthat inflates a Brotli-compressed byte stream and forwards decompressed bytes to a downstream consumer.Purely async/streaming: no
InputStream/OutputStream. Back-pressure from the I/O reactor is propagated viaCapacityChannel. JNI output buffers are copied into small reusable directByteBuffers before handing them to the downstream consumer (which may retain them).Implementation notes
Uses Brotli4j’sDecoderJNI.Wrapper. Native resources are released inreleaseResources(). Throws anIOExceptionif the stream is truncated or corrupted.Ensure
Brotli4jLoader.ensureAvailability()has been called once at startup; this class also invokes it in a static initializer as a safeguard.- Since:
- 5.6
- See Also:
AsyncDataConsumer,CapacityChannel,DecoderJNI
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.hc.core5.http.nio.CapacityChannelcapacityprivate com.aayushatharva.brotli4j.decoder.DecoderJNI.Wrapperdecoderprivate org.apache.hc.core5.http.nio.AsyncDataConsumerdownstream
-
Constructor Summary
Constructors Constructor Description InflatingBrotliDataConsumer(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)private voidpump()voidreleaseResources()voidstreamEnd(java.util.List<? extends org.apache.hc.core5.http.Header> trailers)voidupdateCapacity(org.apache.hc.core5.http.nio.CapacityChannel capacityChannel)
-
-
-
Method Detail
-
updateCapacity
public void updateCapacity(org.apache.hc.core5.http.nio.CapacityChannel capacityChannel) 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 java.io.IOException, org.apache.hc.core5.http.HttpException- Specified by:
streamEndin interfaceorg.apache.hc.core5.http.nio.AsyncDataConsumer- Throws:
java.io.IOExceptionorg.apache.hc.core5.http.HttpException
-
releaseResources
public void releaseResources()
- Specified by:
releaseResourcesin interfaceorg.apache.hc.core5.http.nio.ResourceHolder
-
pump
private void pump() throws java.io.IOException- Throws:
java.io.IOException
-
-