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 ByteBuffers before handing them to the
downstream consumer (which may retain them).
Implementation notes
Uses Brotli4j’sDecoderJNI.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.
AsyncDataConsumer,
CapacityChannel,
DecoderJNI| Constructor and Description |
|---|
InflatingBrotliDataConsumer(AsyncDataConsumer downstream) |
| Modifier and Type | Method and Description |
|---|---|
void |
consume(ByteBuffer src) |
void |
releaseResources() |
void |
streamEnd(List<? extends Header> trailers) |
void |
updateCapacity(CapacityChannel capacityChannel) |
public InflatingBrotliDataConsumer(AsyncDataConsumer downstream)
public void updateCapacity(CapacityChannel capacityChannel) throws IOException
updateCapacity in interface AsyncDataConsumerIOExceptionpublic void consume(ByteBuffer src) throws IOException
consume in interface AsyncDataConsumerIOExceptionpublic void streamEnd(List<? extends Header> trailers) throws IOException, HttpException
streamEnd in interface AsyncDataConsumerIOExceptionHttpExceptionpublic void releaseResources()
releaseResources in interface ResourceHolderCopyright © 1999–2021 The Apache Software Foundation. All rights reserved.