org.apache.hc.client5.http.async.methods

## Class InflatingBrotliDataConsumer

- java.lang.Object
- - org.apache.hc.client5.http.async.methods.InflatingBrotliDataConsumer

All Implemented Interfaces:
  AsyncDataConsumer, ResourceHolder

    public final class InflatingBrotliDataConsumer
    extends Object
    implements AsyncDataConsumer

`AsyncDataConsumer` that 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 via `CapacityChannel`. JNI output buffers are copied into small reusable direct `ByteBuffer`s before handing them to the downstream consumer (which may retain them).

Implementation notes

Uses Brotli4j’s `DecoderJNI.Wrapper`. Native resources are released in `releaseResources()`. Throws an `IOException` if 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`

### Constructor Summary

Constructors
Constructor and Description
`InflatingBrotliDataConsumer(AsyncDataConsumer downstream)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `consume(ByteBuffer src)`
`void` `releaseResources()`
`void` `streamEnd(List<? extends Header> trailers)`
`void` `updateCapacity(CapacityChannel capacityChannel)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### InflatingBrotliDataConsumer

    public InflatingBrotliDataConsumer(AsyncDataConsumer downstream)

### Method Detail

#### updateCapacity

    public void updateCapacity(CapacityChannel capacityChannel)
                        throws IOException

Specified by:
  `updateCapacity` in interface `AsyncDataConsumer`
Throws:
  `IOException`

#### consume

    public void consume(ByteBuffer src)
                 throws IOException

Specified by:
  `consume` in interface `AsyncDataConsumer`
Throws:
  `IOException`

#### streamEnd

    public void streamEnd(List<? extends Header> trailers)
                   throws IOException,
                          HttpException

Specified by:
  `streamEnd` in interface `AsyncDataConsumer`
Throws:
  `IOException`
  `HttpException`

#### releaseResources

    public void releaseResources()

Specified by:
  `releaseResources` in interface `ResourceHolder`